mirror of
https://github.com/emn178/js-sha256.git
synced 2026-08-12 20:32:16 +08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a54fb31d4 | ||
|
|
1559263f5b |
@@ -1,8 +1,9 @@
|
||||
# js-sha256
|
||||
[](https://github.com/emn178/js-sha256/actions/workflows/ci.yml)
|
||||
[](https://coveralls.io/r/emn178/js-sha256?branch=master)
|
||||
[](https://cdnjs.com/libraries/js-sha256/)
|
||||
[](https://nodei.co/npm/js-sha256/)
|
||||
[](https://www.npmjs.com/package/js-sha256)
|
||||
[](https://www.jsdelivr.com/package/npm/js-sha256)
|
||||
|
||||
A simple SHA-256 / SHA-224 hash function for JavaScript supports UTF-8 encoding.
|
||||
|
||||
## Demo
|
||||
@@ -38,13 +39,12 @@ Load the minified UMD build to expose `sha256` and `sha224` as globals:
|
||||
|
||||
### ES Modules
|
||||
```JavaScript
|
||||
import sha256, { sha224 } from 'js-sha256';
|
||||
import { sha256, sha224 } from 'js-sha256';
|
||||
```
|
||||
|
||||
### CommonJS
|
||||
```JavaScript
|
||||
const sha256 = require('js-sha256');
|
||||
const { sha224 } = sha256;
|
||||
const { sha256, sha224 } = require('js-sha256');
|
||||
```
|
||||
|
||||
### API
|
||||
@@ -77,7 +77,7 @@ hash2.array();
|
||||
Node.js automatically uses its native `crypto` implementation with the same API:
|
||||
|
||||
```JavaScript
|
||||
import sha256, { sha224 } from 'js-sha256';
|
||||
import { sha256, sha224 } from 'js-sha256';
|
||||
|
||||
const hash = sha256.create();
|
||||
hash.update('Message');
|
||||
|
||||
Reference in New Issue
Block a user