user954753
user954753

Reputation: 299

HMAC-SHA1 Example not returning desired hash?

I am using this example: http://msdn.microsoft.com/en-us/library/aa382379%28VS.85%29.aspx

Directly copied and pasted, and using the following link as a reference for checking the digest: http://buchananweb.co.uk/security01.aspx

I am confused on what I am doing wrong. This example is for HMAC-SHA1, correct? If anyone could tell me what is going wrong, or could point me into the right direction, that would be of much help.

Upvotes: 1

Views: 1163

Answers (1)

rossum
rossum

Reputation: 15685

To start with don't try to use complex key derivation functions, just use a simple explicit key like { 0x00, 0x01, 0x02, 0x03 ... }. Alternatively find some HMAC-SHA1 test vectors, such as in FIPS 198a, and use those keys as explicitly given. The FIPS Test Vectors have the advantage of showing expected intermediate results as well so it is easier to pin down exactly where the problem is.

Using different key derivation functions will give you different HMAC results because the actual key used will be different if it is derived differently.

Upvotes: 2

Related Questions