|
|
1.1 root 1: #ifndef u4byte
2: typedef unsigned long u4byte;
3: #endif
4: #ifndef u1byte
5: typedef unsigned char u1byte;
6: #endif
7:
8: #ifndef extract_byte
9: #define extract_byte(x,n) ((u1byte)((x) >> (8 * n)))
10: #endif
11:
12: #ifndef rotl
13: #include <stdlib.h>
14: #pragma intrinsic(_lrotr,_lrotl)
15: #define rotr(x,n) _lrotr(x,n)
16: #define rotl(x,n) _lrotl(x,n)
17: #endif
18:
19: typedef struct
20: {
21: u4byte *l_key;
22: u4byte *s_key;
23: u4byte *mk_tab;
24: u4byte k_len;
25: } TwofishInstance;
26:
27: #define TF_L_KEY_SIZE (40*4)
28: #define TF_S_KEY_SIZE (4*4)
29: #define TF_MK_TAB_SIZE (4*4*256)
30: #define TWOFISH_KS (sizeof(TwofishInstance) + TF_L_KEY_SIZE + TF_S_KEY_SIZE + TF_MK_TAB_SIZE)
31:
32: u4byte * _cdecl twofish_set_key(TwofishInstance *instance, const u4byte in_key[], const u4byte key_len);
33: void _cdecl twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[]);
34: void _cdecl 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.