hmac - Compute HMAC in base64 with different algorythms
hmac(key:string, text:string[, algo: integer])
This function compuite HMAC in BASE64.
From Wikipedia:
In cryptography, an HMAC (sometimes disabbreviated as either keyed-hash message authentication code or hash-based message authentication code) is a specific type of message authentication code (MAC) involving a cryptographic hash function and a secret cryptographic key. It may be used to simultaneously verify both the data integrity and the authentication of a message, as with any MAC. Any 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-X, where X is the hash function used (e.g. HMAC-MD5 or HMAC-SHA1). The cryptographic strength of the HMAC depends upon the cryptographic strength of the underlying hash function, the size of its hash output, and the size and quality of the key.
%define HMAC_SHA1 1;
%define HMAC_SHA224 2;
%define HMAC_SHA256 0;
%define HMAC_SHA384 3;
%define HMAC_SHA512 4
hmac(key:"this is a key",data:"this is a test"); return N2QlRcskbAzqng/Zm5k3z6pkDTBqa8q0Zsx8cPPI1dA=
hmac(algo:0,key:"this is a key",data:"this is a test"); return N2QlRcskbAzqng/Zm5k3z6pkDTBqa8q0Zsx8cPPI1dA=
hmac(algo:1,key:"this is a key",data:"this is a test"); return FWZky3vay5I0/GKafy/FmJxrvYw=
hmac(algo:2,key:"this is a key",data:"this is a test"); return SNDYnrmTQwJtpdzk76+FeLvQXnyYk72Vjo++lA==
hmac(algo:3,key:"this is a key",data:"this is a test"); return R8gwP7XxamCLOJuWygRCMxeTAxcHIS/h6HXqu8N0gs4he+fHKU9pamZKnMmXGuLD
hmac(algo:4,key:"this is a key",data:"this is a test"); return dR++AXStnCcqRCbLixSVEt/FXP1HtlALj/xHtbVnVFaAshzO0kvjcGcq219wHLxSnzXU+9AMQ06rDopHURcIDQ==
Written by Pierre Laplante
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.
1.0 2014-09-09 21:24:14 laplante@sednove.com