swcipher.h

00001 /******************************************************************************
00002  *  swcipher.h   - definition of Class SWCipher used for data cipher/decipher
00003  *
00004  * $Id: swcipher.h 1864 2005-11-20 06:06:40Z scribe $
00005  *
00006  * Copyright 1999 CrossWire Bible Society (http://www.crosswire.org)
00007  *      CrossWire Bible Society
00008  *      P. O. Box 2528
00009  *      Tempe, AZ  85280-2528
00010  *
00011  * This program is free software; you can redistribute it and/or modify it
00012  * under the terms of the GNU General Public License as published by the
00013  * Free Software Foundation version 2.
00014  *
00015  * This program is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * General Public License for more details.
00019  *
00020  */
00021 
00022 #ifndef SWCIPHER_H
00023 #define SWCIPHER_H
00024 
00025 #include <sapphire.h>
00026 
00027 #include <defs.h>
00028 
00029 SWORD_NAMESPACE_START
00030 
00031 class SWDLLEXPORT SWCipher
00032 {
00033 
00034   sapphire master;
00035   sapphire work;
00036 
00037   char *buf;
00038   bool cipher;
00039   unsigned long len;
00040 protected:
00041 public:
00042     SWCipher (unsigned char *key);
00043   virtual void setCipherKey (const char *key);
00044     virtual ~ SWCipher ();
00045   virtual char *Buf (const char *buf = 0, unsigned long len = 0);
00046   virtual char *cipherBuf (unsigned long *len, const char *buf = 0);
00047   virtual void Encode (void);
00048   virtual void Decode (void);
00049 };
00050 
00051 SWORD_NAMESPACE_END
00052 #endif