📄 main.c
字号:
// 3-Des test
#include "conio.h"
#include "stdio.h"
#include "string.h"
#include "memory.h"
#include "Des.h"
//U8 gbDesKey[17]={0xDE, 0x10, 0x9C, 0x58, 0xE8, 0xA4, 0xA6, 0x30};
U8 gbDesKey[17]={0x13, 0x34, 0x57, 0x79, 0x9B, 0xBC, 0xDF, 0xF1};
//U8 gbDesKey[17]={"00000000"};
U8 gbDesKeyLen=8;
void main(void)
{
#if 1
U8 len, buf[255];
U8 str[]="Welcome to 3-DES Test! --杨鹏辉!\nShenZhen Triones 深圳创扬通信.\nEmail: cpuyph@sohu.com 上海电信.";
memset(buf, 0, sizeof(buf));
strcpy(buf, str); //to sure size of 'buf' large than size of 'str'
puts("\nBefore encrypting");
puts(buf);
len = strlen(buf);
DesGo(buf, len, ENCRYPT);
puts("\nAfter encrypting");
puts(buf);
DesGo(buf, len, DECRYPT);
puts("\nAfter decrypting");
puts(buf);
#else
S8 i, buf[17];
// S8 str[9]={0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
S8 str[9]={"11111111"};
U8 ch;
clrscr();
memset(buf, 0, sizeof(buf));
strcpy(buf, str); //to sure size of 'buf' large than size of 'str'
printf("\nBefore encrypting: ");
// puts(buf);
for(i=0; i<8; i++)
{
ch = buf[i];
printf("%02X ", ch);
}
DesGo(buf, 8, ENCRYPT);
printf("\n\nAfter encrypting: ");
for(i=0; i<8; i++)
{
ch = buf[i];
printf("%02X ", ch);
}
DesGo(buf, 8, DECRYPT);
printf("\n\nAfter decrypting: ");
for(i=0; i<8; i++)
{
ch = buf[i];
printf("%02X ", ch);
}
// puts(buf);
#endif
getch();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -