CMS 3D CMS Logo

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 #define INCLUDE_BLOWFISH_DEFINE_H
9 
10 struct BCoptions {
11  unsigned char remove;
12  unsigned char standardout;
13  unsigned char compression;
14  unsigned char type;
15  unsigned long origsize;
16  unsigned char securedelete;
17 };
18 
19 #define ENCRYPT 0
20 #define DECRYPT 1
21 
22 #define endianBig ((unsigned char)0x45)
23 #define endianLittle ((unsigned char)0x54)
24 
25 typedef unsigned int uInt32;
26 
27 #ifdef WIN32 /* Win32 doesn't have random() or lstat */
28 #define random() rand()
29 #define initstate(x, y, z) srand(x)
30 #define lstat(x, y) stat(x, y)
31 #endif
32 
33 #ifndef S_ISREG
34 #define S_ISREG(x) (((x)&S_IFMT) == S_IFREG)
35 #endif
36 
37 #define MAXKEYBYTES 56 /* 448 bits */
38 
39 struct BLOWFISH_CTX {
40  uInt32 P[16 + 2];
41  uInt32 S[4][256];
42 };
43 
44 void Blowfish_Init(BLOWFISH_CTX *ctx, unsigned char *key, int keyLen);
45 
46 void Blowfish_Encrypt(BLOWFISH_CTX *ctx, uInt32 *xl, uInt32 *xr);
47 
48 void Blowfish_Decrypt(BLOWFISH_CTX *ctx, uInt32 *xl, uInt32 *xr);
void Blowfish_Init(BLOWFISH_CTX *ctx, unsigned char *key, int keyLen)
Definition: blowfish.cc:235
unsigned char standardout
Definition: blowfish.h:12
unsigned int uInt32
Definition: blowfish.h:25
unsigned long origsize
Definition: blowfish.h:15
unsigned char type
Definition: blowfish.h:14
void Blowfish_Decrypt(BLOWFISH_CTX *ctx, uInt32 *xl, uInt32 *xr)
Definition: blowfish.cc:207
std::pair< OmniClusterRef, TrackingParticleRef > P
unsigned char compression
Definition: blowfish.h:13
void Blowfish_Encrypt(BLOWFISH_CTX *ctx, uInt32 *xl, uInt32 *xr)
Definition: blowfish.cc:181
constexpr float xr
unsigned char securedelete
Definition: blowfish.h:16