我需要使用RC4对执行结果进行编码.在执行bash脚本之前,我正在测试如何加密数据.
我正在使用下一个命令:
echo -ne "test" | openssl rc4 -k test -nosalt -e -nopad | xxd
Run Code Online (Sandbox Code Playgroud)
输出是:
0000000: bdb1 7f03 ....
Run Code Online (Sandbox Code Playgroud)
现在,如果我尝试使用这个在线RC4编码器http://www.fyneworks.com/encryption/rc4-encryption/index.asp,输出为:DA EA 54 65
不同的输出,具有相同的数据和相同的密钥?数据:"测试"键:"测试"
我还检查了一个我用C编码的小程序,输出和在线编码器相同......所以,问题是,我用命令openssl做错了什么?
谢谢!
我需要帮助来检查我的代码是否正确.代码太大而无法完全包含,因此我只会粘贴受影响的部分.
char *tmp;
tmp=Decode_URL(tmp_data);
sprintf(Data,"%s",tmp);
tmp=Decode_URL(tmp_backup1);
sprintf(DataB[0],"%s",tmp);
tmp=Decode_URL(tmp_backup2);
sprintf(DataB[1],"%s",tmp);
tmp=Decode_URL(tmp_backup3);
sprintf(DataB[2],"%s",tmp);
tmp=Decode_URL(tmp_backup4);
sprintf(DataB[3],"%s",tmp);
tmp=Decode_URL(tmp_backup5);
sprintf(DataB[4],"%s",tmp);
Run Code Online (Sandbox Code Playgroud)
该Decode_URL函数返回一个char *.
所以我的问题是,总是tmp用来接收char *函数返回的是否正确?或者我应该创建更多char *tmpx,每次呼叫一个Decode_URL?
编辑更多信息:
char *Decode_URL(char *url){
char *check;
check=EnDeCrypt(some vars here);
return check;
}
char *EnDeCrypt(const char *pszText, int iTextLen, const char *pszKey)
{
char *cipher;
int a, b, i=0, j=0, k;
int ilen;
int sbox[256];
int key[256];
ilen = strlen(pszKey);
for (a=0; a < 256; a++)
{
key[a] = …Run Code Online (Sandbox Code Playgroud)