@cryptography/sha256 (英语)
JavaScript的高性能同步SHA-256执行. 为浏览器优化.
特征
- 快速射击
- 超轻重量
- ECMAScript 3-6
- 类型
- 已测试
设置
软件包 可通过 npm 财务报告和审定财务报表 yarn
npm install @cryptography/sha256
yarn add @cryptography/sha256
使用量
此套件被优化为小字节输入(<10kb).
此外,还强烈建议在以下情况下执行CPU密集型任务: 网络工作者。 。 。 .
import sha256 from '@cryptography/sha256'
// as Uint32Array([0xa8d627d9, 0x3f518e90, 0x96b6f40e, 0x36d27b76, 0x60fa26d3, 0x18ef1adc, 0x43da750e, 0x49ebe4be])
const array = sha256('Hello World!')
// as hex-string: "a8d627d93f518e9096b6f40e36d27b7660fa26d318ef1adc43da750e49ebe4be"
const hex = sha256('Hello World!', 'hex')
// as binary string: "ÄïükYoUH½LÛ,Zß\nNÆêE©¡`M¢"
const raw = sha256('Hello World!', 'binary')
// UInt32Array as input
const buf = new Uint32Array([0xa8d627d9, 0x3f518e90, 0x96b6f40e, 0x36d27b76, 0x60fa26d3, 0x18ef1adc, 0x43da750e, 0x49ebe4be]);
sha256(buf)
用于散列大文件或其他数据chuncks stream() 创造出一股散心的溪流.
sha256.stream().update('Hello World!').digest();
基准
较快 伪造, (中文(简体) ), sjcl 键 财务报告和审定财务报表 WebCrypto API 页面存档备份,存于互联网档案馆 内 顺序 模式.
2x在桌面浏览器上更快(以Macbook Pro 2016为基准)

移动浏览器4x更快(以iPhone 6S 13.2为基准)

试试你自己
捐款
欢迎捐款! 不久将公布捐款准则.