|
|
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: 34: typedef struct 35: { 36: u4byte *l_key; 37: u4byte *s_key; 38: u4byte *mk_tab; 39: u4byte k_len; 40: } TwofishInstance; 41: 42: #define TF_L_KEY_SIZE (40*4) 43: #define TF_S_KEY_SIZE (4*4) 44: #define TF_MK_TAB_SIZE (4*4*256) 45: #define TWOFISH_KS (sizeof(TwofishInstance) + TF_L_KEY_SIZE + TF_S_KEY_SIZE + TF_MK_TAB_SIZE) 46: 1.1.1.3 root 47: u4byte * twofish_set_key(TwofishInstance *instance, const u4byte in_key[], const u4byte key_len); 48: void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[]); 49: void twofish_decrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[4]); 1.1.1.4 ! root 50: ! 51: #if defined(__cplusplus) ! 52: } ! 53: #endif ! 54: ! 55: #endif // TWOFISH_H
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.