mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-06 16:36:16 +08:00
Add sm3_hmac example
This commit is contained in:
10
js/test.html
10
js/test.html
@@ -8,6 +8,16 @@ var m = [0x61, 0x62, 0x63];
|
||||
var dgst = sm3(m);
|
||||
console.log("sm3(\"abc\") = " + dgst);
|
||||
|
||||
var hmac_key = [0x31, 0x32, 0x33, 0x34, 0x35, 0x36];
|
||||
var hmac = [
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
];
|
||||
sm3_hmac(m, hmac_key, hmac);
|
||||
console.log("sm3_hmac(\"abc\", \"123456\") = " + hmac);
|
||||
|
||||
var user_key = [
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
|
||||
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
|
||||
|
||||
Reference in New Issue
Block a user