Quantcast
Channel: SCN: Message List - HMAC (SHA1) key longer than 81 characters not possible?
Viewing all articles
Browse latest Browse all 10

Re: HMAC (SHA1) key longer than 81 characters not possible?

$
0
0

If you look at the wikipedia page I referenced earlier, you will see it shows:

 

function hmac (key, message)    if (length(key) > blocksize) then        key = hash(key) // keys longer than blocksize are shortened    end if    if (length(key) < blocksize) then        key = key u2225 zeroes(blocksize - length(key)) // keys shorter than blocksize are zero-padded    end if

 

So, you just need to know what the blocksize is and then you will know what max key size can be input into hmac alg. If the key used is larger it will be shortened, and if shorter it will be zero padded to make it same as blocksize.

 

I think for sha-1 the block size is 64, so this should be the max key length for hmac. I found a useful explanation at http://stackoverflow.com/questions/3341167/how-to-implement-hmac-sha1-algorithm-in-qt

 

Thanks,

Tim


Viewing all articles
Browse latest Browse all 10

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>