On Tuesday, December 2, 2014 3:30:21 AM UTC-5, Chebn wrote:
>
> Does anyone have any idea why the derived key is different. I believe I'm
> doing this correctly, but please do point out my mistake
>
> C++
>
> /* 256bit key */
> string key = "Y1Mjycd0+O+AendY5pB58JMlmS0EmBWgjdj2r2KW6qQ=";
> string decodedKey;StringSource(key, true, new Base64Decoder(new
> StringSink(decodedKey)));const byte* keyByte = (const byte*)
> decodedKey.data();
> /* Generate IV *//*
> AutoSeededRandomPool prng;
> byte iv[AES::BLOCKSIZE];
> prng.GenerateBlock(iv, sizeof(iv));
> */
> /* FOR TESTING PURPOSES, HARDCODE IV */
> string iv = "5iFv54dCRq5icQbD7QHQzg==";
> string decodedIv;StringSource(iv, true, new Base64Decoder(new
> StringSink(decodedIv)));const byte* ivByte = (const byte *) decodedIv.data();
>
> byte derivedKey[32];
> PKCS5_PBKDF2_HMAC<CryptoPP::SHA1> pbkdf2;
> pbkdf2.DeriveKey(derivedKey, 32, 0, keyByte, 32, ivByte, 16, 100);
> /*
> * derivedKey: 9tRyXCoQLTbUOLqm3M4OPGT6N25g+o0K090fVp/hflk=
> */
>
> Node-JavaScrit
>
> var key = "Y1Mjycd0+O+AendY5pB58JMlmS0EmBWgjdj2r2KW6qQ=";
> var iv = crypto.randomBytes(16);
> iv = "5iFv54dCRq5icQbD7QHQzg=="; /* HARDCODE IV */
> crypto.pbkdf2(key, iv, 100, 32, function(err, derivedKey) { }
> /*
> * derivedKey: dZqBpZKyUPKn8pU4pyyeAw7Rg8uYd6yyj3WI1MIJSyc=
> */
>
>
This was answered at Stack Overflow at
https://stackoverflow.com/questions/27244449/crypto-pbkdf2-output-is-different-than-rfc2898derivebytes-c-and-crypto-pbkd
--
--
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.
---
You received this message because you are subscribed to the Google Groups
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.