|
|
1.1.1.4 root 1: #ifndef TWOFISH_H
2: #define TWOFISH_H
3:
4: #if defined(__cplusplus)
5: extern "C"
6: {
7: #endif
8:
1.1 root 9: #ifndef u4byte
1.1.1.2 root 10: #define u4byte unsigned __int32
1.1 root 11: #endif
12: #ifndef u1byte
1.1.1.2 root 13: #define u1byte unsigned char
1.1 root 14: #endif
15:
16: #ifndef extract_byte
17: #define extract_byte(x,n) ((u1byte)((x) >> (8 * n)))
18: #endif
19:
20: #ifndef rotl
1.1.1.2 root 21:
22: #ifdef _WIN32
1.1 root 23: #include <stdlib.h>
24: #pragma intrinsic(_lrotr,_lrotl)
25: #define rotr(x,n) _lrotr(x,n)
26: #define rotl(x,n) _lrotl(x,n)
1.1.1.2 root 27: #else
28: #define rotr(x,n) (((x)>>(n))|((x)<<(32-(n))))
29: #define rotl(x,n) (((x)<<(n))|((x)>>(32-(n))))
30: #endif
31:
1.1 root 32: #endif
33: typedef struct
34: {
1.1.1.5 root 35: u4byte l_key[40];
36: u4byte s_key[4];
1.1.1.6 ! root 37: #if !defined (TC_MINIMIZE_CODE_SIZE) || defined (TC_WINDOWS_BOOT_TWOFISH)
1.1.1.5 root 38: u4byte mk_tab[4 * 256];
39: #endif
1.1 root 40: u4byte k_len;
41: } TwofishInstance;
42:
1.1.1.5 root 43: #define TWOFISH_KS sizeof(TwofishInstance)
1.1 root 44:
1.1.1.3 root 45: u4byte * twofish_set_key(TwofishInstance *instance, const u4byte in_key[], const u4byte key_len);
46: void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[]);
47: void twofish_decrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[4]);
1.1.1.4 root 48:
49: #if defined(__cplusplus)
50: }
51: #endif
52:
53: #endif // TWOFISH_H
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.