crypto.subtle.digest
Synchronous Synchronously return a digest generated from the given hash function and data.
Installation
npm install --save crypto-digest-sync
Usage
const digestSync = const arrayBufferToHex = const encodeUtf8 = const input = const hash = console//=> dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f
API
digestSync(algo: string, buffer: ArrayBuffer): ArrayBuffer
Synchronously return a digest generated from the hash function algo
and the data in the buffer
.
Currently the only supported algorithm is 'SHA-256'
.
Direct require
If you only need a single algorithm, you can require that file directly and thus skipping the loading of the other ones. Append a slash followed by the name of the hash function (in lower case without dashes) to the require statement.
Example:
const sha256 = const arrayBufferToHex = const encodeUtf8 = const input = const hash = console//=> dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f