#bitcoin #digest

no-std bitcoin_hashes

Hash functions used by the rust-bitcoin eccosystem

31 releases (17 breaking)

new 0.18.0 Dec 1, 2025
0.17.0 Oct 17, 2025
0.16.0 Dec 17, 2024
0.15.0 Nov 1, 2024
0.1.0 Dec 8, 2018

#780 in Magic Beans

Download history 248278/week @ 2025-08-13 248624/week @ 2025-08-20 318930/week @ 2025-08-27 289371/week @ 2025-09-03 301315/week @ 2025-09-10 294511/week @ 2025-09-17 309774/week @ 2025-09-24 302697/week @ 2025-10-01 290816/week @ 2025-10-08 290577/week @ 2025-10-15 314572/week @ 2025-10-22 317572/week @ 2025-10-29 368127/week @ 2025-11-05 331246/week @ 2025-11-12 395895/week @ 2025-11-19 282051/week @ 2025-11-26

1,436,335 downloads per month
Used in 2,298 crates (150 directly)

CC0 license

435KB
8K SLoC

Bitcoin Hashes Library

This is a simple, no-dependency library which implements the hash functions needed by Bitcoin. These are SHA1, SHA256, SHA256d, SHA512, and RIPEMD160. As an ancillary thing, it exposes hexadecimal serialization and deserialization, since these are needed to display hashes anyway.

Documentation

Minimum Supported Rust Version (MSRV)

This library should always compile with any combination of features on Rust 1.74.0.

Contributions

Contributions are welcome, including additional hash function implementations.

Githooks

To assist devs in catching errors before running CI we provide some githooks. If you do not already have locally configured githooks you can use the ones in this repository by running, in the root directory of the repository:

git config --local core.hooksPath githooks/

Alternatively add symlinks in your .git/hooks directory to any of the githooks we provide.

Running Benchmarks

We use a custom Rust compiler configuration conditional to guard the benchmark code. To run the benchmarks use: RUSTFLAGS='--cfg=bench' cargo +nightly bench.

Dependencies