|
Hi, all
I'm new to Crypto++. I try to use various Hash
function in my application. For MD5, SHA, SHA256, I can get the correct
digest string. But for SHA384 and SHA512, I get defferent result string for the
same input plain text in defferent time and none of these result strings is
correct. Here is my function to call the library.
CryptResult CCipherText::EncryptSHA384(const char
*)
{ unsigned int len =
this->Len(); //get a length of the input
string
unsigned char* ch = (unsigned char*) this->GetData(); //get the data of the input string char tmp[3] = "\0"; char temp[97] = "\0"; SHA384* sha;
SecByteBlock digest(sha->DigestSize()); sha->Update((unsigned char*)ch,
len);
sha->Final(digest); for (i = 0; i < sha->DigestSize(); i++) { sprintf (tmp, "%02x", (int)digest[i]); strcat (temp, tmp); } this->SetEqualTo(temp, strlen(temp) ); //copy back the output string return CryptSuccess; }
I use MSVC 6.0.
Could someone help me?
Yurong
Wei
|
