一个异或加密方案--C语言实现
核心代码:
int OutEncrypt( char *FilePath, char *SecretWord ){FILE * fp ;FILE * fp1;char *p= FilePath , *s= SecretWord;//char fn[128], *p = fn, ps[10], *s = ps; //fn[128]存放加密文件路径,ps[10]存放密码char ch;char *tm = "C:\\temp.temp"; //存放临时文件if(( fp = fopen(p,"rb") )== NULL || ( fp1 = fopen(tm,"wb") ) == NULL ){return 0; //加密失败}ch = fgetc(fp);while( !feof(fp) ){s = SecretWord;while( *s != '\0' ){ch = encrypt( ch, *s++ );fputc( ch, fp1 );ch = fgetc(fp);}}fclose( fp );fclose( fp1);remove(p);rename(tm, p);return 1; //加密成功}创建.dll工程下载地址:http://download.csdn.net/detail/qq2399431200/6274867