1. Added HMAC feature.

2. Changed throw error if input type is incorrect.
This commit is contained in:
Chen, Yi-Cyuan
2017-07-11 11:31:02 +08:00
parent b3e7b83e39
commit ee3b3869bc
10 changed files with 407 additions and 21 deletions
+12
View File
@@ -35,6 +35,18 @@ hash.hex();
var hash2 = sha256.update('Message to hash');
hash2.update('Message2 to hash');
hash2.array();
// HMAC
sha256.hmac('key', 'Message to hash');
sha224.hmac('key', 'Message to hash');
var hash = sha256.hmac.create('key');
hash.update('Message to hash');
hash.hex();
var hash2 = sha256.hmac.update('key', 'Message to hash');
hash2.update('Message2 to hash');
hash2.array();
```
If you use node.js, you should require the module first:
```JavaScript