-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
This page says the following:
a key longer than the output size of the specified hash algorithm will be hashed to derive a correctly-sized key. Therefore, the recommended size of the secret key is the output size of the specified hash algorithm.
However, the HMAC RFC specifies:
Applications that use keys longer than B bytes will first hash the key using H and then use the resultant L byte string as the actual key to HMAC.
B bytes refers to the block size of the hash function, which is different from the output size.
The non-incremental HMAC pages seem to be correct:
The secret key for HMACSHA256 encryption. The key can be any length. However, the recommended size is 64 bytes. If the key is more than 64 bytes long, it is hashed (using SHA-256) to derive a 64-byte key.