blowfish.h

来自「BLOWFISH加密算法」· C头文件 代码 · 共 22 行

H
22
字号
#include "types.h"

#define wipememory2(_ptr,_set,_len) do { volatile char *_vptr=(volatile char *)(_ptr); size_t _vlen=(_len); while(_vlen) { *_vptr=(_set); _vptr++; _vlen--; } } while(0)
#define wipememory(_ptr,_len) wipememory2(_ptr,0,_len)
#define CIPHER_ALGO_BLOWFISH	 4  /* blowfish 128 bit key */

#define BLOWFISH_BLOCKSIZE 8
#define BLOWFISH_ROUNDS 16

typedef struct {
    u32 s0[256];
    u32 s1[256];
    u32 s2[256];
    u32 s3[256];
    u32 p[BLOWFISH_ROUNDS+2];
} BLOWFISH_context;

int bf_setkey( void *c, const byte *key, unsigned keylen );
void encrypt_block( void *bc, byte *outbuf, const byte *inbuf );
void decrypt_block( void *bc, byte *outbuf, const byte *inbuf );

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?