bc_idea.h

来自「BestCrypt开源加密原代码」· C头文件 代码 · 共 73 行

H
73
字号
#ifndef __BC_IDEA#define __BC_IDEA#include "bc_types.h"#define SERVICE_NAME	"BC_IDEA"#define DISPLAY_NAME    "IDEA"#define BLOCK_LENGTH	8#define ALGORITHM_ID	0x20#define DRIVER_MAJOR_VERSION	0#define DRIVER_MINOR_VERSION	1#define IDEA_ROUNDS             8#define IDEA_SUBKEYS_PER_ROUND  6#define IDEA_FINAL_SUBKEYS      4// Key lengths in bytes#define IDEA_KEY_LENGTH_BYTES   16// Expanded key length in 16-bit words#define IDEA_EXPANDED_KEY_SIZE (IDEA_SUBKEYS_PER_ROUND*IDEA_ROUNDS + IDEA_FINAL_SUBKEYS)// Key length in bits - required for external definitions of // BestCrypt Algorithm modules#define KEY_LENGTH          (128)// We need to reserve space both for encryption and decryption keys#define KEY_LENGTH_EXTENDED (IDEA_EXPANDED_KEY_SIZE*2*16)/* IdeaExtKey structure describes a place in memory for extended Idea key */typedef struct IdeaExtKey_ {    WORD encryptKeys[ IDEA_EXPANDED_KEY_SIZE ];    WORD decryptKeys[ IDEA_EXPANDED_KEY_SIZE ];} IdeaExtKey; //IdeaData; /******* Exported functions *********/#define INBOOLKeyExtend( PUCHAR KeySource,          // 8-bit  uchars           PDWORD KeyDestination );   // 32-bit dwordsVOIDEncrypt( DWORD *IVector,          DWORD *KeyAdress,         DWORD *SrcBuffer,         DWORD *DstBuffer,         DWORD Length );    // in bytesVOIDDecrypt( DWORD *IVector,          DWORD *KeyAdress,         DWORD *SrcBuffer,         DWORD *DstBuffer,         DWORD Length );    // in bytes/*    Declare IDEA encryption in Electronic Code Book mode    for testing the IDEA implementation - not for using   in the BestCrypt Encryption Algorithm Module */BOOL IdeaECB( UCHAR      *InBlock,          UCHAR      *OutBlock,         IdeaExtKey *ExtKey,         BOOL       Encrypt);#endif

⌨️ 快捷键说明

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