Reputation: 987
I have adopted the SHA1 HMAC example from Microsoft's website and modified it according to this stack-overflow post and some other suggestions on the Internet, however I am unable to produce correct values.
Basically I just replaced SHA1 with MD5 CALG_SHA1 -> CALG_MD5.
Does anyone have a working example?
Does it matter what algo is used for CryptDeriveKey() for the password (RC2 or RC4)?
Thanks!
Edit: Found working code here
Upvotes: 2
Views: 1368
Reputation: 1345
Your values are different from examples cause you use different keys:
Example values can be obtained using Linux openssl dgst -md5 -hmac key < input
command. This command uses key as is if its length smaller than MD5 hash block length (64 bytes) otherwise its uses MD5(key) as key and not key derived using CryptDeriveKey(RC4, MD5(key)) like in your implementation.
Upvotes: 1