CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
blowfish.h
Go to the documentation of this file.
1 /*
2  * Author : Paul Kocher
3  * E-mail : pck@netcom.com
4  * Date : 1997
5  * Description: C implementation of the Blowfish algorithm.
6  */
7 
8 
9 #define INCLUDE_BLOWFISH_DEFINE_H
10 
11 struct BCoptions{
12  unsigned char remove;
13  unsigned char standardout;
14  unsigned char compression;
15  unsigned char type;
16  unsigned long origsize;
17  unsigned char securedelete;
18 };
19 
20 #define ENCRYPT 0
21 #define DECRYPT 1
22 
23 #define endianBig ((unsigned char) 0x45)
24 #define endianLittle ((unsigned char) 0x54)
25 
26 typedef unsigned int uInt32;
27 
28 #ifdef WIN32 /* Win32 doesn't have random() or lstat */
29 #define random() rand()
30 #define initstate(x,y,z) srand(x)
31 #define lstat(x,y) stat(x,y)
32 #endif
33 
34 #ifndef S_ISREG
35 #define S_ISREG(x) ( ((x)&S_IFMT)==S_IFREG )
36 #endif
37 
38 #define MAXKEYBYTES 56 /* 448 bits */
39 
40 struct BLOWFISH_CTX {
41  uInt32 P[16 + 2];
42  uInt32 S[4][256];
43 };
44 
45 void Blowfish_Init(BLOWFISH_CTX *ctx, unsigned char *key, int keyLen);
46 
48 *xr);
49 
51 *xr);
void Blowfish_Encrypt(BLOWFISH_CTX *ctx, uInt32 *xl, uInt32 *xr)
Definition: blowfish.cc:299
unsigned char standardout
Definition: blowfish.h:13
void Blowfish_Decrypt(BLOWFISH_CTX *ctx, uInt32 *xl, uInt32 *xr)
Definition: blowfish.cc:326
void Blowfish_Init(BLOWFISH_CTX *ctx, unsigned char *key, int keyLen)
Definition: blowfish.cc:355
uInt32 S[4][256]
Definition: blowfish.h:42
unsigned int uInt32
Definition: blowfish.h:26
uInt32 P[16+2]
Definition: blowfish.h:41
unsigned long origsize
Definition: blowfish.h:16
unsigned char type
Definition: blowfish.h:15
unsigned char compression
Definition: blowfish.h:14
unsigned char securedelete
Definition: blowfish.h:17