bc_bf128.h
来自「加密解密,安全工具!很有意思的代码」· C头文件 代码 · 共 88 行
H
88 行
#ifndef __BC_BFISH
#define __BC_BFISH
#include "bc_types.h"
#define SERVICE_NAME "BC_BF128"
#define DISPLAY_NAME "BLOWFISH-128"
#define ALGORITHM_ID 0xC0
// Key length in bits
#define KEY_LENGTH (128)
#define KEY_LENGTH_EXTENDED (4168*8)
#define BLOCK_LENGTH 8#define DRIVER_MAJOR_VERSION 1
#define DRIVER_MINOR_VERSION 1
/******* Hardware dependences *******/
// Currently we choose Intel processor
#define ORDER_DCBA
/* DCBA - little endian - Intel */
#ifdef ORDER_DCBA
union unionDWORD
{ DWORD Dword;
struct
{ BYTE Byte3;
BYTE Byte2;
BYTE Byte1;
BYTE Byte0;
} Byte;
};
#endif /* ORDER_DCBA */
/* ABCD - big endian - Motorola */
#ifdef ORDER_ABCD
union unionDWORD
{ DWORD Dword;
struct
{ BYTE Byte0;
BYTE Byte1;
BYTE Byte2;
BYTE Byte3;
} Byte;
};
#endif /* ORDER_ABCD */
/* BADC - VAX */
#ifdef ORDER_BADC
union unionDWORD
{ DWORD Dword;
struct
{ BYTE Byte1;
BYTE Byte0;
BYTE Byte3;
BYTE Byte2;
} Byte;
};
#endif /* ORDER_BADC */
/******* Exported functions *********/
#define IN
BOOL
KeyExtend( PUCHAR KeySource, // 56 8-bit uchars
PDWORD KeyDestination ); // (4168/4) 32-bit dwords
VOID
Encrypt( DWORD *IVector,
DWORD *KeyAdress,
DWORD *SrcBuffer,
DWORD *DstBuffer,
DWORD Length ); // in bytes
VOID
Decrypt( DWORD *IVector,
DWORD *KeyAdress,
DWORD *SrcBuffer,
DWORD *DstBuffer,
DWORD Length ); // in bytes
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?