Hash input
using SHA-2 512/256
function
sha
hashInto?: TypedArray<ArrayBufferLike>
): TypedArray;
@param input
string
, Uint8Array
, or ArrayBuffer
to hash. Uint8Array
or ArrayBuffer
will be faster
@param hashInto
optional Uint8Array
to write the hash to. 32 bytes minimum.
This hashing function balances speed with cryptographic strength. This does not encrypt or decrypt data.
The implementation uses BoringSSL (used in Chromium & Go)
The equivalent openssl
command is:
# You will need OpenSSL 3 or later
openssl sha512-256 /path/to/file
@param input
string
, Uint8Array
, or ArrayBuffer
to hash. Uint8Array
or ArrayBuffer
will be faster
@param encoding
DigestEncoding
to return the hash in
This hashing function balances speed with cryptographic strength. This does not encrypt or decrypt data.
The implementation uses BoringSSL (used in Chromium & Go)
The equivalent openssl
command is:
# You will need OpenSSL 3 or later
openssl sha512-256 /path/to/file
Referenced types
type StringOrBuffer = string | NodeJS.TypedArray | ArrayBufferLike
type DigestEncoding = 'utf8' | 'ucs2' | 'utf16le' | 'latin1' | 'ascii' | 'base64' | 'base64url' | 'hex'