施奈尔的河豚
Schneier's Blowfish
有人能给我看一下Schneier的Blowfish代码的用法示例吗(http://www.schneier.com/code/bfsh-sch.zip),即用给定的密钥加密和解密字符串,用C或C++?
提前谢谢。
编辑:这不是家庭作业。
这是一个测试
#include <stdio.h>
#include "blowfish.h"
#include <string.h>
int main(void)
{
unsigned long xl = 1, xr = 2;
char key[] = "Hello";
/* NoErr is defined as 0 in the blowfish.c file */
if (opensubkeyfile () != 0)
{
printf ("nCannot open subkey file");
perror ("Exit");
printf ("n");
return 1;
};
InitializeBlowfish (key, 7);
Blowfish_encipher (&xl, &xr);
printf("n%x %x", xl, xr);
Blowfish_decipher (&xl, &xr);
printf("n%x %x", xl, xr);
if ((xl == 1) && (xr == 2))
{
printf("nDecipher OK.");
}
else
{
printf("nDecipher Failn");
}
printf ("n");
return 0;
}
请确保头文件名的大小写为字符。还要注意,文件名blowfish.dat
是正确的。
还可以从本页查看Paul Kocher的实施:http://www.schneier.com/blowfish-download.html
相关文章:
- 瓦尔格林德:数学函数"Conditional jump or move depends on uninitialised value(s)"
- 编译要在英特尔Hyperscan中使用的.cc文件时出现问题
- 将gsl c++程序与"英特尔MKL"链接
- C++ OpenCV 卡尔曼滤波器构造函数错误
- 使用英特尔 PIN 修改寄存器
- 使用英特尔内联函数将打包的 8 位整数乘以浮点数向量
- 为什么瓦尔格林德在不释放恶意内存后没有报告任何问题?
- 如何使用英特尔 PIN 捕获阵列的所有负载?
- 库特<<恩德尔;不适用于打印 2D 阵列
- 在 OpenGL 中将笛卡尔世界坐标转换为球面局部坐标
- 英特尔 TBB 程序不会终止,可能会误用参考计数器
- C++库库尔如何发送FTP文件usign STOR和REST
- C++结构到德尔福记录dll调用
- 瓦尔格林德的内存泄漏使用新的
- CPP 中的瓦尔格林德和记忆泄漏:"Conditional jump or move depends on uninitialised values"
- 将"-01"替换为"-02" 英特尔编译器选项会导致 FPE 在较小的 for 循环行程计数中抛出
- 如何在贝尔曼福特算法中检测负循环?
- 在C++上实现高斯赛德尔迭代方法
- 在 Azure DevOps 构建管道中使用英特尔C++编译器为 Linux 环境构建C++代码
- 施奈尔的河豚