SchneierのBlowfishコード( http://www.schneier.com/code/bfsh-sch.zip)の使用例、つまり、CまたはC ++での特定のキーを使用した文字列の暗号化と復号化を教えてもらえますか?
前もって感謝します。
編集:これは宿題ではありません。
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 Fail\n");
}
printf ("\n");
return 0;
}
ヘッダー ファイル名の大文字と小文字を確認してください。blowfish.dat
また、ファイル名が正しいことに注意してください。
また、このページから Paul Kocher の実装を見てください: http://www.schneier.com/blowfish-download.html