aardio 文档

aardio 范例: HMAC-SHA

//HMAC-SHA
import console;
import crypt.bin;
import crypt.hmac;

key = '\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b';
data =  "Hi There"; 

//HMAC-SHA1 
var hmacData = crypt.hmac.sha1(key,data).getValue(); 
hmacData = crypt.bin.encodeBase64( hmacData );
console.log( hmacData,#hmacData ) 

//HMAC-SHA256
var hmacData = crypt.hmac.sha256(key,data).getValue(); 
hmacData = crypt.bin.encodeBase64( hmacData );
console.log( hmacData,#hmacData ) 

console.pause();
Markdown 格式