签名是MD5 的,不可能做到爆破,密码长度也可以随意设置,就像RSA P/S Key 一样选择512 或者1024 位密码来加密..
引用
评论
#include <malloc.h>
#include <memory.h>
#include <stdio.h>
#include <string.h>
#include "encoder_md5.h"
#include "encoder_xor.h"
void main(int argc,char** argv) {
if (3==argc) {
FILE* file=fopen(argv[1],"r");
if (NULL!=file) {
fseek(file,0,SEEK_END);
unsigned long file_size=ftell(file);
fseek(file,0,SEEK_SET);
char* buffer=(char*)malloc(file_size+LENGTH_MD5);
if (NULL!=buffer) {
fread(buffer+LENGTH_MD5,1,file_size,file);
fclose(file);
char*
md5=calcu_md5(&buffer[LENGTH_MD5],file_size);
memcpy(buffer,md5,LENGTH_MD5);
encoder_xor((unsigned
char*)buffer,file_size+LENGTH_MD5,(unsigned char*)argv[2],strlen(argv[2]));
file=fopen(argv[1],"w+");
fwrite(buffer,1,file_size+LENGTH_MD5,file);
fclose(file);
free(buffer);
} else
printf("Alloc Memory ERROR!");
} else
printf("Open ERROR!");
}
}
</string.h></stdio.h></memory.h></malloc.h>
#include <malloc.h>
#include <memory.h>
#include <stdio.h>
#include <string.h>
#include "encoder_md5.h"
#include "encoder_xor.h"
void main(int argc,char** argv) {
if (3==argc) {
FILE* file=fopen(argv[1],"r");
if (NULL!=file) {
fseek(file,0,SEEK_END);
unsigned long file_size=ftell(file);
fseek(file,0,SEEK_SET);
char* buffer=(char*)malloc(file_size);
if (NULL!=buffer) {
fread(buffer,1,file_size,file);
fclose(file);
encoder_xor((unsigned
char*)buffer,file_size,(unsigned char*)argv[2],strlen(argv[2]));
char*
md5=calcu_md5(&buffer[LENGTH_MD5],file_size-LENGTH_MD5);
char
sorc_md5[LENGTH_MD5+1]={0};
char
dest_md5[LENGTH_MD5+1]={0};
memcpy(sorc_md5,buffer,LENGTH_MD5);
memcpy(dest_md5,md5,LENGTH_MD5);
if (!strcmp(sorc_md5,dest_md5))
{
file=fopen(argv[1],"w+");
fwrite(&buffer[LENGTH_MD5],1,file_size-LENGTH_MD5,file);
fclose(file);
} else
printf("ERROR
Password!");
free(buffer);
} else
printf("Alloc Memory
ERROR!");
} else
printf("Open ERROR!");
}
}</string.h></stdio.h></memory.h></malloc.h>