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

📄 test.c

📁 Crypto code code source codes nvmjvhmkh,bj L:L::
💻 C
字号:
#include <stdio.h>
#include <stdlib.h>

#include "../include/blowfish.h"

int main(int argc, char *argv[])
{
	puts("Blowfish testing function...");
	blowfish_context_t *ctx = (blowfish_context_t *)malloc(sizeof(blowfish_context_t));
	if(!ctx) {
		puts("Could not allocate enough memory!");
		return -1;
	}
	blowfish_initiate(ctx, "TESTKEY", 7);
	unsigned long hi = 1, lo = 2;
	blowfish_encryptblock(ctx, &hi, &lo);
	printf("Encoded: %08lX %08lX\n", hi, lo);
	if((hi == 0xDF333FD2) && (lo == 0x30A71BB4))
		puts("Encryption Test Passed");
	else puts("Encryption Test Failed");
	blowfish_decryptblock(ctx, &hi, &lo);
	if((hi == 1) && (lo == 2))
		puts("Decryption Test Passed");
	else puts("Decryption Test Failed");

	puts("Done!");
	blowfish_clean(ctx);
	free(ctx);
	return 0;
}

⌨️ 快捷键说明

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