util/hmac.lua

changeset 3540
bc139431830b
parent 2925
692b3c6c5bd2
equal deleted inserted replaced
3539:8bbd965267b2 3540:bc139431830b
38 hash 38 hash
39 the hash function 39 the hash function
40 blocksize 40 blocksize
41 the blocksize for the hash function in bytes 41 the blocksize for the hash function in bytes
42 hex 42 hex
43 return raw hash or hexadecimal string 43 return raw hash or hexadecimal string
44 --]] 44 --]]
45 function hmac(key, message, hash, blocksize, hex) 45 function hmac(key, message, hash, blocksize, hex)
46 if #key > blocksize then 46 if #key > blocksize then
47 key = hash(key) 47 key = hash(key)
48 end 48 end

mercurial