Hallo...
ich hab hier ein Problem mit blowfish
rein geht:
0383FBFF00000662
raus kommt:
?æC¢¸Î?Ø?/첡?)?
code:
Ich benutz VC++ 2005 (7)
ich hab hier ein Problem mit blowfish
rein geht:
0383FBFF00000662
raus kommt:
?æC¢¸Î?Ø?/첡?)?
code:
C++:
vector<unsigned long> crypt_blow(const char * in){
std::vector<unsigned long> v;
const char * plaintext=in;
BLOWFISH_CTX ctx;
char salt[]="hi";
Blowfish_Init (&ctx, (unsigned char*)salt, strlen(salt));
unsigned long L, R=2;
for(unsigned int i=0; i<strlen(plaintext); i++)
{
L=(unsigned long) plaintext[i];
Blowfish_Encrypt(&ctx, &L, &R);
v.push_back(L);
}
return v;
}
string uncrypt_blow(vector<unsigned long> &v){
string str;
BLOWFISH_CTX ctx;
char salt[]="hi";
Blowfish_Init (&ctx, (unsigned char*)salt, strlen(salt));
unsigned long L, R=2;
for(unsigned int x = 0; x < v.size(); ++x){
L = v.at(x);
cout << "Cr: " << L << "\t";
Blowfish_Decrypt(&ctx, &L, &R);
static char Ret[100]="";
sprintf(Ret,"%c\0",L);
cout << "Un: " << L << endl;
str += Ret;
}
return str;
}
Ich benutz VC++ 2005 (7)