On a side note ignore the name in the class, This function is not intended to use RSA. I'm playing around with that as well.
On Aug 18, 7:38 am, Dillon Beresford <[email protected]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi Wei/Jeff/All, > > Good morning. I have been experimenting with a function that I threw > together after an idea I came up with for reducing the size of my > HMAC result. > > The objective was to reduce the size of the SHA512 HMAC and provide an > extra layer of security by encrypting the initial HMAC StrinkSink() > result. I've noticed some strange behavior after testing the function. > > It appears that my HMAC CIPHER produces duplicate results > intermittently. Around one and ten yields duplicate results. > > Thanks, > > Dillon Beresford > > - ---snip > > void rsaesecsha::HMACtoRSA(const char *hexKey, const char* iFile) > { > > CryptoPP::member_ptr<CryptoPP::MessageAuthenticationCode> mac; > > std::string decodedKey; > > CryptoPP::StringSource(hexKey, true, > new CryptoPP::HexDecoder( > new CryptoPP::StringSink(decodedKey))); > > mac.reset(new CryptoPP::HMAC<CryptoPP::SHA512>(( > const byte *)decodedKey.data(), decodedKey.size())); > > std::cout << "HMAC KEY: "; > > CryptoPP::FileSource(iFile, true, > new CryptoPP::HashFilter(*mac, > new CryptoPP::HexEncoder( > new CryptoPP::FileSink(cout)))); > > std::cout << std::endl << std::endl; > std::cout << "HMAC CIPHER: "; > > std::string outStr; > > CryptoPP::DefaultEncryptorWithMAC encrypt(hexKey, > new CryptoPP::HexEncoder( > new CryptoPP::StringSink(outStr))); > > encrypt.Put((byte *)hexKey, strlen(hexKey)); > encrypt.MessageEnd(); > > std::cout << outStr << std::endl; > > } > > Results from my last test... > > HMAC KEY: > BB84150047202212F696E7BCC13549CA01318D32AAD2845E2B67DE03C6C4ADCA3E9A4261C5742A936718ECA174B87F866709ADF971C70C080D27A31888435A13 > > HMAC CIPHER: > 27F354E712A3797BF691C4E97959A1A0BA53FCF9C32A5446FB86731898EA1FEDF2B8E7B240A9B5522D685F1A0548E81CCE60156815701AA6 > > - ------------ > > HMAC KEY: > BB84150047202212F696E7BCC13549CA01318D32AAD2845E2B67DE03C6C4ADCA3E9A4261C5742A936718ECA174B87F866709ADF971C70C080D27A31888435A13 > > HMAC CIPHER: > 27F354E712A3797BF691C4E97959A1A0BA53FCF9C32A5446FB86731898EA1FEDF2B8E7B240A9B5522D685F1A0548E81CCE60156815701AA6 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/ > > iEYEARECAAYFAkqKoLwACgkQRnxC5lZRuuEsGQCgi0AU32JTwmNokkdAUsZnB1HK > //UAnRxuOmgLSTEci3VRuEgtSc49t1SL > =rmrR > -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~---
