CCProxy字符串加密解密代码
(2011-07-09 10:20:30)
标签:
ccproxy密码编码解码it |
分类: 网络编程 |
原文于2006年8月5号发布在自己的QQ空间,现转载过来!
在网络上看到CCProxy的加密算法为999-ASCII(c)(本来好长的算法,被我总结成了一句),所以自己写了一个加密解密的程序,比网络上的只是一解密功能的要算法要简单多了,只用while完成加密解密功能。
C++代码
-
#include
<string.h> -
#include
<stdio.h> -
int
main( intargc, char*argv[]) -
{
-
char chEnString[128] = {0}; -
char chDeString[43] = {0}; -
-
if (argc!=3) -
{ -
printf("Usage: Password.exe );[-decode|-encode] \"string\"" -
return 0; -
} -
if (strcmp(argv[1], "-decode")==0) -
{ -
strcpy(chEnString,argv[2]); -
int i = 0; -
while (chEnString!= '\0') -
{ -
int ch =999 -( (chEnString-48)*100+(chEnString-48)*10+chEnString-48); -
printf("%c",ch); -
i += 3; -
} -
} -
else if(strcmp(argv[1],"-encode")==0) -
{ -
strcpy(chDeString,argv[2]); -
int j = 0; -
while (chDeString[j]!= '\0') -
{ -
int temp = 999-chDeString[j]; -
printf("=",temp); -
j++; -
} -
} -
else -
printf("Usage: Password.exe );[-decode|-encode] \"string\"" -
return 0; -
}