mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
# Conflicts: # jsowell-ui/.env.development # jsowell-ui/.env.staging # jsowell-ui/bin/build-sit.bat # jsowell-ui/bin/build.bat # jsowell-ui/src/api/adapayMember/adapayMember.js # jsowell-ui/src/api/pile/merchant.js # jsowell-ui/src/router/index.js # jsowell-ui/src/views/financial/financeDetail.vue # jsowell-ui/src/views/financial/merchant.vue # jsowell-ui/src/views/homeIndex/homeIndex.vue # jsowell-ui/src/views/login.vue # jsowell-ui/src/views/pile/basic/detail.vue # jsowell-ui/src/views/pile/station/components/SiteInfo.vue # jsowell-ui/src/views/pile/station/detail.vue # jsowell-ui/src/views/pile/station/orderReport.vue
45 lines
1.7 KiB
Markdown
45 lines
1.7 KiB
Markdown
# sha.js
|
|
[](https://www.npmjs.org/package/sha.js)
|
|
[](https://travis-ci.org/crypto-browserify/sha.js)
|
|
[](https://david-dm.org/crypto-browserify/sha.js#info=dependencies)
|
|
|
|
[](https://github.com/feross/standard)
|
|
|
|
Node style `SHA` on pure JavaScript.
|
|
|
|
```js
|
|
var shajs = require('sha.js')
|
|
|
|
console.log(shajs('sha256').update('42').digest('hex'))
|
|
// => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049
|
|
console.log(new shajs.sha256().update('42').digest('hex'))
|
|
// => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049
|
|
|
|
var sha256stream = shajs('sha256')
|
|
sha256stream.end('42')
|
|
console.log(sha256stream.read().toString('hex'))
|
|
// => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049
|
|
```
|
|
|
|
## supported hashes
|
|
`sha.js` currently implements:
|
|
|
|
- SHA (SHA-0) -- **legacy, do not use in new systems**
|
|
- SHA-1 -- **legacy, do not use in new systems**
|
|
- SHA-224
|
|
- SHA-256
|
|
- SHA-384
|
|
- SHA-512
|
|
|
|
|
|
## Not an actual stream
|
|
Note, this doesn't actually implement a stream, but wrapping this in a stream is trivial.
|
|
It does update incrementally, so you can hash things larger than RAM, as it uses a constant amount of memory (except when using base64 or utf8 encoding, see code comments).
|
|
|
|
|
|
## Acknowledgements
|
|
This work is derived from Paul Johnston's [A JavaScript implementation of the Secure Hash Algorithm](http://pajhome.org.uk/crypt/md5/sha1.html).
|
|
|
|
|
|
## LICENSE [MIT](LICENSE)
|