## v0.10.0 / 2023-08-30

### Fixed
- Chrome bug by workaround. #40
- deprecated `new Buffer`, replace with `Buffer.from`. #34
- dependencies and security issues. #32, #36

### Changed
- TypeScript interface, secretKey can be bytes like message. #23, #25
- remove `eval` and use `require` directly. #18, #26
This commit is contained in:
Yi-Cyuan Chen
2023-08-30 22:58:30 +08:00
parent 16b101f040
commit bb8ae3a623
11 changed files with 85 additions and 58 deletions
+13 -5
View File
@@ -48,25 +48,33 @@ var hash2 = sha256.hmac.update('key', 'Message to hash');
hash2.update('Message2 to hash');
hash2.array();
```
### Node.js
If you use node.js, you should require the module first:
```JavaScript
var sha256 = require('js-sha256');
```
or
or
```JavaScript
var sha256 = require('js-sha256').sha256;
var sha224 = require('js-sha256').sha224;
```
or
```JavaScript
const { sha256, sha224 } = require('js-sha256');
```
### TypeScript
or TypeScript
```TypeScript
import { sha256, sha224 } from 'js-sha256';
```
### RequireJS
It supports AMD:
```JavaScript
require(['your/path/sha256.js'], function(sha256) {
// ...
});
```
or TypeScript
```TypeScript
import { sha256, sha224 } from 'js-sha256';
```
## Example
```JavaScript
sha256(''); // e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855