mirror of
https://github.com/emn178/js-sha256.git
synced 2026-08-12 20:32:16 +08:00
1. Added HMAC feature.
2. Changed throw error if input type is incorrect.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user