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