Skip to content
NOUMENResearch
Network
Engineering
, home page

IntelligenceAlgorithmssha-2

SHA-2 (SHA-224, SHA-256, SHA-384, SHA-512)

The SHA-2 family of hash functions from FIPS 180-4, including SHA-256 and SHA-512. It is used almost everywhere, from TLS certificates and code signing to Bitcoin block and transaction hashes. Grover's search would roughly halve its effective security, so 256-bit outputs stay adequate.

In short

What a quantum computer changes.

Quantum effect
Weakened by Grover's search
Family
HashRests on hash function security.
What it means
Grover's algorithm searches an unstructured space in roughly the square root of the usual number of steps. Against a symmetric key or a hash preimage, that roughly halves the effective security in bits: a 128-bit key gives about 64 bits of security against it. In practice the answer is size, not replacement. Keys and outputs of 256 bits stay adequate. Grover's search also needs a long, sequential run on a fault-tolerant machine and does not split well across many machines, so the effect is a smaller margin, not a break.

This describes the family, not any project that uses it.

69 in the catalogue

Packages that provide it

Packages that provide SHA-2 (SHA-224, SHA-256, SHA-384, SHA-512)
PackageProvides
@noble/hashesnpmPure TypeScript hash, MAC and KDF library: SHA-1, SHA-2, SHA-3 and Keccak, BLAKE2 and BLAKE3, RIPEMD-160, HMAC, HKDF, PBKDF2, scrypt and Argon2.
hash-wasmnpmHash and password-hashing functions compiled to WebAssembly, including SHA-1, SHA-2, SHA-3, Keccak, BLAKE2, BLAKE3, RIPEMD-160, HMAC, PBKDF2, scrypt, bcrypt and Argon2.
hash.jsnpmPure JavaScript SHA-1, SHA-2 and RIPEMD-160 hashes with HMAC, for Node.js and browsers.
js-sha256npmPure JavaScript SHA-256 and SHA-224 hash functions with HMAC.
sha.jsnpmPure JavaScript SHA-0, SHA-1, SHA-224, SHA-256, SHA-384 and SHA-512 with a Node-style streaming interface.
@aws-crypto/sha256-jsnpmPure JavaScript SHA-256 implementation from the AWS SDK crypto helpers.
crypto-jsnpmPure JavaScript library of hashes, HMAC, PBKDF2 and ciphers: MD5, SHA-1, SHA-2, a Keccak function it calls SHA3, RIPEMD-160, AES, TripleDES, RC4 and Rabbit.
sjclnpmStanford JavaScript Crypto Library; the default npm build provides AES in CCM, OCB2 and GCM modes, SHA-256, HMAC, PBKDF2 and a Fortuna-style random generator.
tweetnaclnpmPure JavaScript port of TweetNaCl: X25519 with XSalsa20-Poly1305 public-key boxes, XSalsa20-Poly1305 secret boxes, Ed25519 signatures and SHA-512.
libsodium-wrappersnpmlibsodium compiled to WebAssembly and JavaScript with generated wrappers: X25519, Ed25519, XSalsa20-Poly1305 and ChaCha20-Poly1305 encryption, BLAKE2b, SHA-2, SHA-3, HMAC, Argon2 password hashing, ML-KEM-768 and the X-Wing hybrid KEM.
libsodium-wrappers-sumonpmThe sumo build of libsodium.js: everything in libsodium-wrappers plus scrypt password hashing and lower-level functions.
sodium-nativenpmLow-level native Node.js bindings to libsodium: X25519, Ed25519, XSalsa20-Poly1305 and ChaCha20-Poly1305 encryption, BLAKE2b, SHA-2, HMAC, Argon2 and scrypt, plus a PBKDF2-SHA512 extension.
@stablelib/sha256npmTypeScript SHA-256 hash function.
node-forgenpmPure JavaScript cryptography and PKI toolkit: RSA signing and encryption, Ed25519, AES (including GCM), DES and RC2, SHA-1, SHA-2, MD5, HMAC, PBKDF2, a Fortuna-based random generator, X.509, PKCS formats and a TLS implementation.
jsrsasignnpmPure JavaScript library for RSA, RSA-PSS, ECDSA and DSA signatures, hashes and HMAC, PKCS key formats, X.509 certificates, CRL, OCSP, CMS and JWS/JWT.
@peculiar/webcryptonpmWebCrypto API implementation for Node.js on top of the built-in crypto module, adding curves such as secp256k1, brainpool, Ed448 and X448 and non-standard mechanisms such as DES and RSAES-PKCS1-v1_5.
crypto-browserifynpmBrowser port of the Node.js crypto module that re-exports the browserify packages for hashes, HMAC, PBKDF2, AES, Diffie-Hellman, ECDH, RSA and ECDSA signing and RSA encryption.
create-hashnpmNode-style createHash for browsers that dispatches to sha.js, ripemd160 and md5.js, and to the built-in crypto module in Node.js.
node-josenpmJOSE (JWS, JWE, JWK) implementation from Cisco with RSA, ECDSA and ECDH on the NIST P curves, HMAC, AES (GCM, CBC-HMAC and key wrap), HKDF and PBES2.
openpgpnpmOpenPGP.js, a JavaScript implementation of OpenPGP (RFC 9580): RSA, DSA, ECDSA and ECDH on NIST, brainpool and secp256k1 curves, Ed25519, Ed448, X25519 and X448, AES with GCM, OCB and EAX, and Argon2 key derivation.
ethersnpmEthereum library with secp256k1 signing, recovery and ECDH, Keccak-256, SHA-2, RIPEMD-160, HMAC, PBKDF2 and scrypt helpers, BIP-39 and BIP-32 wallets, and encrypted JSON keystores.
@ethersproject/hdnodenpmThe ethers v5 sub-package for BIP-32 key derivation and BIP-39 mnemonics over secp256k1.
viemnpmTypeScript Ethereum interface with secp256k1 local accounts, BIP-39 and BIP-32 accounts, WebAuthn P-256 accounts, and Keccak-256, SHA-256 and RIPEMD-160 utilities.
ethereum-cryptographynpmCollection of the primitives Ethereum uses: secp256k1, BN254 and BLS12-381 curves, Keccak, SHA-2, RIPEMD-160, BLAKE2b, PBKDF2, scrypt, AES, BIP-32, BIP-39 and random bytes.
ethereumjs-utilnpmThe pre-scoped EthereumJS utility package with Keccak, SHA-256 and RIPEMD-160 hashing and secp256k1 signing and recovery.
micro-eth-signernpmMinimal Ethereum library for secp256k1 transaction and message signing, legacy and EIP-2335 keystores, EIP-2333 key derivation, and KZG and PeerDAS blob commitments.
@metamask/key-treenpmMetaMask interface over BIP-39, BIP-32, BIP-44 and SLIP-10 key derivation for secp256k1 and Ed25519 keys.
bitcoinjs-libnpmBitcoin transaction and PSBT library that hashes with SHA-256 and RIPEMD-160 and signs and verifies ECDSA and Taproot Schnorr signatures through a pluggable secp256k1 backend.
bitcoinjs-messagenpmSigns and verifies Bitcoin signed messages with secp256k1 ECDSA over a double SHA-256 message hash.
@scure/btc-signernpmBitcoin transaction and PSBT library with secp256k1 ECDSA, BIP-340 Schnorr and Taproot signing, MuSig2, and SHA-256 and RIPEMD-160 script hashing.
bip32npmBIP-32 hierarchical deterministic keys over secp256k1, using HMAC-SHA512 for derivation and Hash160 for fingerprints, with ECDSA and Schnorr signing through an injected secp256k1 library.
bip39npmBIP-39 mnemonic generation and validation, with a SHA-256 checksum and PBKDF2-HMAC-SHA512 seed derivation.
@scure/bip32npmBIP-32 hierarchical deterministic wallets over secp256k1, with HMAC-SHA512 derivation, Hash160 fingerprints and ECDSA signing.
@scure/bip39npmBIP-39 mnemonic generation and validation, with a SHA-256 checksum and PBKDF2-HMAC-SHA512 seed derivation.
hdkeynpmBIP-32 hierarchical deterministic keys with HMAC-SHA512 derivation and secp256k1 signing and verification.
ed25519-hd-keynpmSLIP-0010 hierarchical key derivation for Ed25519 using HMAC-SHA512.
@solana/web3.jsnpmSolana JavaScript SDK that signs transactions with Ed25519 key pairs and derives program addresses with SHA-256.
@iden3/js-cryptonpmiden3 primitives: Baby Jubjub EdDSA, Poseidon, SHA-256 and random bytes.
@polkadot/util-cryptonpmPolkadot crypto utilities: sr25519, Ed25519 and secp256k1 keys and signatures, BLAKE2, Keccak, SHA-2, HMAC, PBKDF2, scrypt, NaCl secretbox and encrypted JSON.
@polkadot/wasm-cryptonpmWebAssembly build of the Rust primitives behind @polkadot/util-crypto: sr25519, Ed25519, secp256k1, BLAKE2b, Keccak, SHA-2, HMAC, PBKDF2, scrypt and BIP-39.
@cosmjs/cryptonpmCosmJS cryptography: secp256k1 and Ed25519 signing, SHA-2, Keccak-256, RIPEMD-160, HMAC, BIP-39, SLIP-10, Argon2id and XChaCha20-Poly1305.
@libp2p/noisenpmNoise XX handshake connection encrypter for libp2p using X25519, ChaCha20-Poly1305, SHA-256 and HKDF.
@chainsafe/libp2p-noisenpmThe former package of the libp2p Noise handshake connection encrypter using X25519, ChaCha20-Poly1305, SHA-256 and HKDF.
@ton/cryptonpmTON crypto primitives: SHA-256, SHA-512, HMAC-SHA-512, PBKDF2-SHA-512, TON mnemonics, Ed25519 signing, NaCl secret boxes and SLIP-10 Ed25519 HD keys.
@stellar/stellar-sdknpmStellar SDK whose base module builds, hashes and signs transactions with Ed25519 key pairs.
@stellar/stellar-basenpmLow-level Stellar library to read, write, hash and sign XDR structures with Ed25519 key pairs.
ringcrates.ioCryptographic library largely derived from BoringSSL, offering ECDSA P-256 and P-384, Ed25519, RSA signatures, X25519 and ECDH, AES-GCM, ChaCha20-Poly1305, SHA-1 and SHA-2, HMAC, HKDF, PBKDF2 and a system random generator.
aws-lc-rscrates.ioring-compatible Rust API over the AWS-LC C library, adding ML-KEM, ML-DSA, RSA encryption, raw AES modes and an optional FIPS build.
aws-lc-syscrates.ioLow-level generated FFI bindings to the AWS-LC C cryptography library, which aws-lc-rs wraps.
opensslcrates.ioRust bindings to OpenSSL covering TLS, X.509, RSA, DSA, Diffie-Hellman, elliptic curve and Edwards curve keys, symmetric ciphers, hashes, MACs and key derivation.
openssl-syscrates.ioRaw FFI declarations for the OpenSSL C library, used by the openssl crate.
boringcrates.ioRust bindings to BoringSSL with TLS support, RSA, DSA, Diffie-Hellman, ECDSA and ECDH, Ed25519 and X25519, ML-KEM, ML-DSA, HPKE, AEAD ciphers, hashes, HMAC and key derivation.
mbedtlscrates.ioRust wrapper for Mbed TLS covering TLS, X.509, RSA, ECDSA, ECDH, Diffie-Hellman, AES and ChaCha20-Poly1305, hashes, HMAC, HKDF, PBKDF2 and DRBG random generators.
botancrates.ioRust wrapper for the Botan C++ library, exposing ciphers, hashes, MACs, KDFs, password hashing, random generators, X.509 and classical and post-quantum public key algorithms.
libcruxcrates.ioRe-export crate for the libcrux library of formally verified implementations, including ML-KEM, ML-DSA, X25519, P-256 ECDSA and ECDH, Ed25519, RSA-PSS, AES-GCM, ChaCha20-Poly1305, SHA-2, SHA-3, BLAKE2, HMAC, HKDF and HPKE.
orioncrates.ioPure Rust library offering ML-KEM, ML-DSA, X-Wing, HPKE, X25519, (X)ChaCha20-Poly1305, BLAKE2b, BLAKE3, SHA-2, SHA-3, HMAC, HKDF, PBKDF2, Argon2 and scrypt.
dryoccrates.ioPure Rust libsodium-compatible library with crypto_box, secretbox, Ed25519 signatures, BLAKE2b, SHA-2, SHA-3, HMAC, HKDF, Argon2 password hashing, ML-KEM-768, X-Wing and HPKE sealed boxes.
sodiumoxidecrates.ioRust bindings to libsodium: X25519 crypto_box, XSalsa20-Poly1305 secretbox, Ed25519 signatures, ChaCha20-Poly1305 and AES-256-GCM AEADs, SHA-2, BLAKE2b, HMAC, Argon2 and scrypt password hashing.
libsodium-syscrates.ioRaw FFI bindings to the libsodium C library, used by sodiumoxide.
sha2crates.ioPure Rust SHA-2 hash functions: SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 and SHA-512/256.
hmac-sha256crates.ioSmall self-contained SHA-256, HMAC-SHA256 and HKDF-SHA256 in pure Rust.
rustlscrates.ioTLS 1.2 and TLS 1.3 library in Rust whose cryptography comes from a pluggable provider, aws-lc-rs by default or ring.
snowcrates.ioPure Rust implementation of the Noise Protocol Framework with 25519, AES-GCM, ChaCha20-Poly1305, SHA-2, BLAKE2 and optional P-256 and BLAKE3.
sequoia-openpgpcrates.ioOpenPGP (RFC 9580 and RFC 4880) implementation with RSA, DSA, ECDSA, ECDH, EdDSA, X25519 and X448 keys, post-quantum ML-KEM, ML-DSA and SLH-DSA algorithms, AES and SHA-1, SHA-2 and SHA-3 hashes.
ark-crypto-primitivescrates.ioArkworks building blocks for SNARK circuits: Pedersen and Bowe-Hopwood hashes, Pedersen and BLAKE2s commitments, Poseidon sponges, a SHA-256 CRH, Merkle trees, a BLAKE2s PRF and Schnorr signatures, with optional R1CS constraints.
bitcoin_hashescrates.ioThe hash functions used by rust-bitcoin: SHA-1, SHA-256 (plain, double and tagged), SHA-384, SHA-512, SHA3-256, RIPEMD-160 and HASH160, plus HMAC, HKDF and SipHash.
bitcoincrates.ioThe rust-bitcoin library for Bitcoin data structures, keys, addresses, PSBTs and BIP32, signing with libsecp256k1 (ECDSA and Taproot Schnorr) and hashing with SHA-256 and RIPEMD-160.
revm-precompilecrates.ioEVM precompiled contracts for revm: ecrecover (secp256k1), P-256 verification (RIP-7212), SHA-256, RIPEMD-160, the BLAKE2 compression function, modexp, BN254 operations and pairing, BLS12-381 operations (EIP-2537) and KZG point evaluation (EIP-4844).
solana-sdkcrates.ioThe Solana client SDK: Ed25519 keypairs and 64-byte Ed25519 transaction signatures, with SHA-256, Keccak-256 and BLAKE3 hashing modules.

1 listed

Sources

  1. FIPS 180-4: Secure Hash Standard (SHS)csrc.nist.govRetrieved 3 December 2026

Full record

Identifier
sha-2
Kind
hash
Family
Hash
Rests on
hash function security
Quantum effect
Weakened by Grover's search

Standards