Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions doc/generated/backends-hkdf.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,20 @@ What each backend states on constant time, as the capability table read it:
| hash2

| wasip2
| sodium, hash2, openssl
| hash2, sodium, openssl
| hash2, sodium, openssl
| hash2, sodium, openssl
| sodium, hash2, openssl
| hash2

| wasip3
| sodium, hash2, openssl
| hash2, sodium, openssl
| hash2, sodium, openssl
| hash2, sodium, openssl
| sodium, hash2, openssl
| hash2

| emscripten
| sodium, hash2
| hash2, sodium
| sodium, hash2
| sodium, hash2
| hash2
|===
Expand All @@ -163,20 +163,20 @@ What each backend states on constant time, as the capability table read it:
| hash2

| wasip2
| bearssl, hash2, sodium, openssl
| bearssl, sodium, hash2, openssl
| hash2, bearssl, sodium, openssl
| bearssl, hash2, sodium, openssl
| bearssl, sodium, hash2, openssl
| hash2

| wasip3
| bearssl, hash2, sodium, openssl
| bearssl, sodium, hash2, openssl
| hash2, bearssl, sodium, openssl
| bearssl, hash2, sodium, openssl
| bearssl, sodium, hash2, openssl
| hash2

| emscripten
| bearssl, sodium, hash2
| hash2, sodium, bearssl
| sodium, hash2, bearssl
| bearssl, sodium, hash2
| hash2
|===
Expand Down
82 changes: 41 additions & 41 deletions doc/generated/compare-digests.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -161,124 +161,124 @@
| Name | Fastest natively | Smallest on Emscripten | Where it is used | Choose it when

| <<hash-legacy,`md5_128`>>
| 787 MiB/s (hash2)
| 13,160 bytes (hash2)
| 933 MiB/s (hash2)
| 8,039 bytes (hash2)
| link:https://www.rfc-editor.org/rfc/rfc6151[legacy checksums and old protocols; RFC 6151 retires it for signatures]
| Only to read or check data that already uses it.

| <<hash-legacy,`sha1_160`>>
| 858 MiB/s (hash2)
| 15,407 bytes (hash2)
| 1,190 MiB/s (hash2)
| 10,285 bytes (hash2)
| link:https://git-scm.com/docs/hash-function-transition[Git's original object ids, with collision detection]; link:https://shattered.io/[the first public collision, SHAttered (2017)]; link:https://sha-mbles.github.io/[the first public chosen-prefix collision, SHA-1 is a Shambles (2020)]
| Only to read or check data that already uses it.

| <<hash-sha2,`sha2_224`>>
| 387 MiB/s (hash2)
| 19,237 bytes (hash2)
| 606 MiB/s (hash2)
| 14,116 bytes (hash2)
| link:https://doi.org/10.6028/NIST.FIPS.180-4[FIPS 180-4's shorter SHA-2]
| When a standard asks for it; otherwise SHA-256.

| <<hash-sha2,`sha2_256`>>
| 385 MiB/s (hash2)
| 19,235 bytes (hash2)
| 593 MiB/s (hash2)
| 14,108 bytes (hash2)
| link:https://bitcoin.org/bitcoin.pdf[Bitcoin's block and transaction ids (twice)]; link:https://github.com/nostr-protocol/nips/blob/master/01.md[Nostr's event ids (NIP-01)]; link:https://git-scm.com/docs/hash-function-transition[Git's SHA-256 object format]; link:https://www.rfc-editor.org/rfc/rfc8446#appendix-B.4[TLS 1.3's cipher suites]
| The default digest: interoperable everywhere, in every browser, fast with hardware support.

| <<hash-sha2,`sha2_384`>>
| 586 MiB/s (hash2)
| 22,704 bytes (hash2)
| 913 MiB/s (hash2)
| 17,579 bytes (hash2)
| link:https://www.rfc-editor.org/rfc/rfc8446#appendix-B.4[TLS 1.3's AES-256 cipher suite]
| When a standard asks for 192-bit strength, or a digest that resists length extension within SHA-2.

| <<hash-sha2,`sha2_512`>>
| 592 MiB/s (hash2)
| 22,713 bytes (hash2)
| 940 MiB/s (hash2)
| 17,582 bytes (hash2)
| link:https://www.rfc-editor.org/rfc/rfc8032#section-5.1[Ed25519's signatures]; link:https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki[BIP39's seeds, through PBKDF2-HMAC-SHA-512]
| When a standard asks for it, or for a 512-bit digest.

| <<hash-sha2,`sha2_512_224`>>
| 586 MiB/s (hash2)
| 22,766 bytes (hash2)
| 941 MiB/s (hash2)
| 17,645 bytes (hash2)
| link:https://doi.org/10.6028/NIST.FIPS.180-4[FIPS 180-4's truncated SHA-512]
| When a standard asks for it.

| <<hash-sha2,`sha2_512_256`>>
| 586 MiB/s (hash2)
| 22,722 bytes (hash2)
| 911 MiB/s (hash2)
| 17,597 bytes (hash2)
| link:https://doi.org/10.6028/NIST.FIPS.180-4[FIPS 180-4's truncated SHA-512]
| A 256-bit SHA-2 digest that resists length extension, fast on 64-bit machines.

| <<hash-sha3,`sha3_224`>>
| 464 MiB/s (hash2)
| 12,296 bytes (hash2)
| 733 MiB/s (hash2)
| 7,175 bytes (hash2)
| link:https://doi.org/10.6028/NIST.FIPS.202[FIPS 202]
| When a standard asks for it.

| <<hash-sha3,`sha3_256`>>
| 438 MiB/s (hash2)
| 12,290 bytes (hash2)
| 692 MiB/s (hash2)
| 7,172 bytes (hash2)
| link:https://doi.org/10.6028/NIST.FIPS.203[ML-KEM, NIST's post-quantum key encapsulation]
| A standard 256-bit digest that is not SHA-2, immune to length extension.

| <<hash-sha3,`sha3_384`>>
| 338 MiB/s (hash2)
| 12,257 bytes (hash2)
| 529 MiB/s (hash2)
| 7,140 bytes (hash2)
| link:https://doi.org/10.6028/NIST.FIPS.202[FIPS 202]
| When a standard asks for it.

| <<hash-sha3,`sha3_512`>>
| 232 MiB/s (hash2)
| 12,263 bytes (hash2)
| 369 MiB/s (hash2)
| 7,142 bytes (hash2)
| link:https://doi.org/10.6028/NIST.FIPS.203[ML-KEM, NIST's post-quantum key encapsulation]
| When a standard asks for it.

| <<hash-sha3,`shake_128`>>
| 541 MiB/s (hash2)
| 12,271 bytes (hash2)
| 848 MiB/s (hash2)
| 7,151 bytes (hash2)
| link:https://doi.org/10.6028/NIST.FIPS.203[ML-KEM's and ML-DSA's matrix expansion]
| To draw a long stream of bytes from one input, at 128-bit security.

| <<hash-sha3,`shake_256`>>
| 438 MiB/s (hash2)
| 12,271 bytes (hash2)
| 688 MiB/s (hash2)
| 7,151 bytes (hash2)
| link:https://www.rfc-editor.org/rfc/rfc8032#section-5.2[Ed448's signatures]
| To draw a long stream of bytes from one input, at 256-bit security.

| <<hash-keccak,`keccak_256`>>
| 567 MiB/s (xkcp)
| 124,708 bytes (xkcp)
| 998 MiB/s (xkcp)
| 24,057 bytes (xkcp)
| link:https://ethereum.github.io/yellowpaper/paper.pdf[Ethereum's addresses, transaction ids and state]; link:https://eips.ethereum.org/EIPS/eip-55[EIP-55's checksummed addresses]
| For Ethereum and every format that names Keccak-256; never in place of SHA3-256.

| <<hash-blake2,`blake2b_512`>>
| 1,012 MiB/s (hash2)
| 17,106 bytes (hash2)
| 1,617 MiB/s (hash2)
| 11,982 bytes (hash2)
| link:https://www.rfc-editor.org/rfc/rfc9106#section-3.2[Argon2's internal hash]; link:https://doc.libsodium.org/hashing/generic_hashing[libsodium's generic hash]
| A fast software digest or keyed hash where SHA-2 has no hardware support.

| <<hash-blake2,`blake2s_256`>>
| 600 MiB/s (hash2)
| 16,105 bytes (hash2)
| 921 MiB/s (hash2)
| 10,974 bytes (hash2)
| link:https://www.wireguard.com/protocol/[WireGuard's hash, MAC and HKDF]
| For WireGuard-style protocols and 32-bit targets.

| <<hash-blake3,`blake3`>>
| 2,062 MiB/s (blake3)
| 122,432 bytes (blake3)
| 2,414 MiB/s (blake3)
| 21,252 bytes (blake3)
| link:https://github.com/BLAKE3-team/BLAKE3-specs/blob/master/blake3.pdf[the BLAKE3 specification: a Merkle tree, for verified streaming and content addressing]
| Large data verified in parts, content addressing, and key derivation from a context string.

| <<hash-legacy,`ripemd_128`>>
| 685 MiB/s (hash2)
| 14,542 bytes (hash2)
| 989 MiB/s (hash2)
| 9,421 bytes (hash2)
| link:https://homes.esat.kuleuven.be/~bosselae/ripemd160.html[the RIPEMD family's page]
| Only to read existing data.

| <<hash-legacy,`ripemd_160`>>
| 443 MiB/s (hash2)
| 16,730 bytes (hash2)
| 610 MiB/s (hash2)
| 11,607 bytes (hash2)
| link:https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki[Bitcoin's hash160 (P2PKH, P2WPKH)]
| For Bitcoin's hash160; never in a new design.
|===

The measured columns are doc/measurements.json's (2026-11-15, Apple M5 Max): the native throughput over 1 MiB, or the time of one derivation over `hmac_sha2_256`, of the fastest backend, and the smallest Emscripten program that calls the function; <<hash-measurements>> has every backend on every target. The data was measured on a loaded, shared machine, so close figures may swap at the next measurement.
The measured columns are doc/measurements.json's (2026-11-16, Apple M5 Max): the native throughput over 1 MiB, or the time of one derivation over `hmac_sha2_256`, of the fastest backend, and the smallest Emscripten program that calls the function; <<hash-measurements>> has every backend on every target.
18 changes: 9 additions & 9 deletions doc/generated/compare-kdfs.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,28 @@
| Name | Fastest natively | Smallest on Emscripten | Where it is used | Choose it when

| <<hash-hkdf,`hkdf_extract`>>
| 732 ns (hash2)
| 117,928 bytes (hash2)
| 480 ns (sodium)
| 17,499 bytes (hash2)
| link:https://github.com/nostr-protocol/nips/blob/master/44.md[NIP-44's conversation key]; link:https://www.rfc-editor.org/rfc/rfc8446#section-7.1[TLS 1.3's key schedule]
| When a protocol names the extract step alone.

| <<hash-hkdf,`hkdf_expand`>>
| 774 ns (sodium)
| 119,801 bytes (sodium)
| 489 ns (sodium)
| 24,778 bytes (sodium)
| link:https://www.rfc-editor.org/rfc/rfc8446#section-7.1[TLS 1.3's key schedule]; link:https://signal.org/docs/specifications/doubleratchet/[Signal's Double Ratchet]
| Keys from a key that is already uniform (a master key), one per info label.

| <<hash-hkdf,`hkdf`>>
| 1.54 µs (sodium)
| 116,952 bytes (bearssl)
| 980 ns (sodium)
| 23,281 bytes (bearssl)
| link:https://www.rfc-editor.org/rfc/rfc8446#section-7.1[TLS 1.3]; link:https://signal.org/docs/specifications/doubleratchet/[Signal's protocols]; link:https://www.wireguard.com/protocol/[WireGuard (over HMAC-BLAKE2s)]
| The default way to turn one secret into several keys. Never for passwords.

| <<hash-pbkdf2,`pbkdf2`>>
| 9.2 ms (openssl)
| 122,671 bytes (hash2)
| 6.1 ms (openssl)
| 29,235 bytes (hash2)
| link:https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki[BIP39's seeds (2,048 iterations of HMAC-SHA-512)]; link:https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html[OWASP: 600,000 iterations of HMAC-SHA-256 for passwords]
| When a standard or FIPS 140 demands it; otherwise Argon2id for passwords.
|===

The measured columns are doc/measurements.json's (2026-11-15, Apple M5 Max): the native throughput over 1 MiB, or the time of one derivation over `hmac_sha2_256`, of the fastest backend, and the smallest Emscripten program that calls the function; <<hash-measurements>> has every backend on every target. The data was measured on a loaded, shared machine, so close figures may swap at the next measurement.
The measured columns are doc/measurements.json's (2026-11-16, Apple M5 Max): the native throughput over 1 MiB, or the time of one derivation over `hmac_sha2_256`, of the fastest backend, and the smallest Emscripten program that calls the function; <<hash-measurements>> has every backend on every target.
Loading
Loading