[源码和文档分享]基于C++的分组密码加解密实现

1 设计实现html

程序完成课程设计全部必作与选作的要求,包含的函数以下:dom

// S 盒置换函数

BlockType SBox_Encode(BlockType x);测试

// S 盒逆变换加密

BlockType SBox_Decode(BlockType x); 设计

// P 盒置换code

BlockType PBox_Encode(BlockType x); htm

// P 盒逆变换ip

BlockType PBox_Decode(BlockType x); 源码

// 输出显示一个 16 位二进制数

void OutPut_Bin(BlockType p);

// 输出显示一个密钥

void OutPut_Key(KeyType key);

// 分组加密函数

void BlockEncryption(BlockType PlainText, BlockType

&CipherText, KeyType Key);

// 分组解密函数

void BlockDecryption(BlockType &PlainText, BlockType

CipherText, KeyType Key);

// 生成指定密钥

void Key_Engine();

// 随机生成密钥

void Key_Random();

// 文件加密

int FileEncryption(char *PlainFile,char *CipherFile,KeyType Key);

// 文件解密

int FileDecryption(char *PlainFile,char *CipherFile,KeyType Key);

// 加密函数的运行速度

unsigned long EncryptionTime(unsigned long Times);

// 线性密码分析

BlockType LinearCryptanalysis(unsigned long T,BlockType Text[][2]);

// 差分密码分析

BlockType DiffCryptanalysis(unsigned long T,BlockType Text[][4]);

// 测试分组加密与解密

void TestBlockEncrypt();

// 测试文件加密与解密

void TestFileEncrypt();

// 测试运行速度

void TestEncryptionTime();

// 测试线性密码分析

void TestLinearCryptanalysis();

// 测试差分密码分析

void TestDiffCryptanalysis();

// 测试线性分析函数成功时明密文对数

void TestLinearSucceedTimes();

// 测试差分分析函数成功时明密文对数

void TestDiffSucceedTimes();

// 暂停,按回车键继续

void Wait();

测试程序只需打开生成的可执行文件,按提示操做便可。

运行截图以下:

源码下载地址:https://www.write-bug.com/article/1306.html

相关文章
相关标签/搜索