📄 encryption.c
字号:
/*blowfish_test.c: Test file for blowfish.cCopyright (C) 1997 by Paul KocherThis library is free software; you can redistribute it and/ormodify it under the terms of the GNU Lesser General PublicLicense as published by the Free Software Foundation; eitherversion 2.1 of the License, or (at your option) any later version.This library is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNULesser General Public License for more details.You should have received a copy of the GNU Lesser General PublicLicense along with this library; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/#include "blowfish.h"#include "sha.h"
#include "BigInt.h"
#include <stdio.h>#include <string.h>
//int main()
//{
// BLOWFISH_CTX ctx;
// char *buf = "password";
// char pw[17];
// char key[41];
// sBigInt k, x, y, z;
// int i;
// BigIntInit(&k);
// BigIntInit(&x);
// BigIntInit(&y);
// BigIntInit(&z);
// GetSessionKey(&k, &x);
// Mov(&y, k);
// /*printf("%s", "Password(equal to or less than 16): ");
// scanf("%s", buf);
// while(strlen(buf) > 16)
// {
// printf("%s", "Password must be equal to or less than 16!\nPassword: ");
// scanf("%s", buf);
// }*/
//
// strncpy(pw, buf, 17);
// shaDriver(pw, key);
//
// Blowfish_Init (&ctx, (unsigned char*)key, 40);
// Blowfish_Encrypt(&ctx, &y.m_ulValue[0], &y.m_ulValue[1]);
// Blowfish_Encrypt(&ctx, &y.m_ulValue[2], &y.m_ulValue[3]);
// Mov(&z, y);
// Blowfish_Decrypt(&ctx, &z.m_ulValue[0], &z.m_ulValue[1]);
// Blowfish_Decrypt(&ctx, &z.m_ulValue[2], &z.m_ulValue[3]);
// for(i=0; i<k.m_nLength; i++)
// {
// printf("%x\t%x\t%x\n", k.m_ulValue[i], y.m_ulValue[i], z.m_ulValue[i]);
// }
// /*if (L == 0xDF333FD2L && R == 0x30A71BB4L)
// printf("Test encryption OK.\n");
// else
// printf("Test encryption failed.\n");
// Blowfish_Decrypt(&ctx, &L, &R);
//
// if (L == 1 && R == 2)
// printf("Test decryption OK.\n");
// else
// printf("Test decryption failed.\n");*/
//
// return 0;
//}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -