Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef _crypto_h_
- #define _crypto_h_
- #include "type.h"
- #include "def.h"
- /* LFSR */
- typedef struct {
- uint32 state;
- uint8 taps[32];
- } CRYPTO_LFSR;
- void cyrpto_LFSRinit(CRYPTO_LFSR *LFSR, uint32 state, uint8 *taps);
- uint32 crypto_LFSRshift(CRYPTO_LFSR *LFSR);
- /* PRNG */
- uint32 crypto_rand(uint32 seed);
- /* [STREAM] RC4 */
- typedef struct {
- uint8 S[256];
- } CRYPTO_RC4;
- void crypto_RC4init(CRYPTO_RC4 *rc4, uint8 *key, uint32 keysz);
- uint8 crypto_RC4byte(CRYPTO_RC4 *rc4);
- void crypto_RC4inplace(CRYPTO_RC4 *rc4, uint8 *data, uint32 sz);
- void crypto_RC4encrypt(uint8 *key, uint32 keysz, uint8 *data, uint32 datasz);
- /* [BLOCK] XTEA */
- void crypto_XTEAencrypt(uint32 rounds, uint32 data[2], uint32 key[4]);
- void crypto_XTEAdecrypt(uint32 rounds, uint32 data[2], uint32 key[4]);
- /* [BLOCK] SKIPJACK */
- uint16 crypto_SKIPJACK_G(uint16 g, uint8 k, uint8 *key);
- uint16 crypto_SKIPJACK_Gi(uint16 g, uint8 k, uint8 *key);
- void crypto_SKIPJACKencrypt(uint16 data[4], uint8 key[5]);
- void crypto_SKIPJACKdecrypt(uint16 data[4], uint8 key[5]);
- /* [KEY XCNG] DIFFIE-HELLMAN */
- typedef struct {
- uint32 p, g;
- uint32 a, A;
- uint32 secret;
- } crypto_DHKE;
- void crypto_DHKEinit(crypto_DHKE *DHKE, uint32 p, uint32 g);
- void crypto_DHKEcomputeshared(crypto_DHKE *DHKE, uint32 B);
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement