⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 des.h

📁 DES/DES3 with operators of CBC and OFB
💻 H
字号:
#ifndef _DES_H
#define _DES_H
/*
#ifndef unit8
#define unit8  unsigned char
#endif

#ifndef unit32
#define unit32 unsigned long int
#endif

*/
#ifndef unit32
#define unit32 unsigned int 
#endif

#ifndef unit8
#define unit8 unsigned char 
#endif

typedef struct
{
    unit32 esk[32];     /* DES encryption subkeys */
    unit32 dsk[32];     /* DES decryption subkeys */
}
des_context;

typedef struct
{
    unit32 esk[96];     /* Triple-DES encryption subkeys */
    unit32 dsk[96];     /* Triple-DES decryption subkeys */
}
des3_context;

int  des_set_key( des_context *ctx, unit8 key[8] );
void des_encrypt( des_context *ctx, unit8 input[8], unit8 output[8] );
void des_decrypt( des_context *ctx, unit8 input[8], unit8 output[8] );

int  des3_set_2keys( des3_context *ctx, unit8 key1[8], unit8 key2[8] );
int  des3_set_3keys( des3_context *ctx, unit8 key1[8], unit8 key2[8],
                                        unit8 key3[8] );

void des3_encrypt( des3_context *ctx, unit8 input[8], unit8 output[8] );
void des3_decrypt( des3_context *ctx, unit8 input[8], unit8 output[8] );



#endif /* des.h */

⌨️ 快捷键说明

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