Algorithms

HASH256

SHA-256 twice. Bitcoin transaction ids and block hashes and the Base58Check checksum
IDhash25616 / 24cryptographic · 256-bit
Hash / Cryptographic

HASH256 (double SHA-256)

SHA-256 twice, every txid and block hash.

Digest
256-bit · 32 bytes
HMAC
no key mode
Security
128-bit collision resistance
Used by
Bitcoin
1 option, 0 required

Sample

hex
bc62d4b80d9e36da29c16c5d4d9f11731f36052c72401a76c23c0fb5a9b74423
base64
vGLUuA2eNtopwWxdTZ8Rcx82BSxyQBp2wjwPtam3RCM=

Options

encodingstring
default hex
Output encoding: hex, base64, base64url, binary

Access

Createcreate("hash256")
CLIhashes hash256 'hello world'
Tryplayground with the sample above
Kinsha256, sha384, sha512, sha512-half +11

SHA-256 of SHA-256. Bitcoin's txids, block hashes, merkle nodes, and the 4-byte checksum at the end of every Base58Check string.

ts
create("hash256").hash("hello").digest;
// "9595c9df90075148eb06860365df33584b75bff782a510c6cd4883a419833d50"
create("sha256").hash(create("sha256").hash("hello", { encoding: "binary" }).digest).digest;
// the same, spelled out

The digest comes out in hash order. Block explorers print txids and block hashes byte-reversed, so compare against a reversed string or reverse the bytes first. Everybody trips over this once. No HMAC mode.