Interested in improving this site? Please check the To Do page.
crypt.hmacSHA1
Keyed-hashing for message authentication using SHA1.
Syntax
crypt.hmacSHA1 (s, key, flTranslate)
Params
- s, a string.
- key, a string.
- flTranslate is an optional boolean parameter, determining the format of the return value.
Returns
A string.
Examples
crypt.hmacSHA1 ("Hi There", string.hexStringToBinary ("0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"))
“b617318655057264e28bc0b6fb378c8ef146be00”
crypt.hmacSHA1("what do ya want for nothing?", "Jefe")
“effcdf6ae5eb2fa2d27416d5f184df9c259a7c79”
crypt.hmacSHA1(string.hexStringToBinary
("0xDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"),
string.hexStringToBinary ("0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"))
“125d7342b9ac11cd91a39af48aa17b4f63f175d3”
Notes
As defined in Wikipedia, A keyed-hash message authentication code, or HMAC, is a type of message authentication code (MAC) calculated using a cryptographic hash function in combination with a secret key. As with any MAC, it may be used to simultaneously verify both the data integrity and the authenticity of a message. Any iterative cryptographic hash function, such as MD5 or SHA-1, may be used in the calculation of an HMAC; the resulting MAC algorithm is termed HMAC-MD5 or HMAC-SHA-1 accordingly. The cryptographic strength of the HMAC depends upon the cryptographic strength of the underlying hash function and on the size and quality of the key.