$ bitcoin_hashes

v0.18.0

Hash functions used by the rust-bitcoin eccosystem

Downloads: 24.3M
Recent: 4.1M
Versions: 34
Updated: December 4, 2025

Latest Update Summary

Crate

Name: bitcoin_hashes New version: 0.17.0 Release date: 2023-10-14T20:30:14Z

Crate readme

Short description Library with support for de/serialization, parsing and executing on data-structures and network messages related to Bitcoin.

Long description This library supports de/serialization of Bitcoin protocol network messages, blocks, transactions, private keys, and addresses. It also offers BIP-0032 support and PSBT v0 de/serialization, although it should not be used for consensus code due to potential deviations from the Bitcoin Core reference implementation. The library is intended for use with Rust 1.74.0 or later and provides no-std support.

Features • De/serialization of Bitcoin protocol network messages • De/serialization of blocks and transactions • Script de/serialization • Private keys and address creation, de/serialization and validation with full BIP-0032 support • PSBT v0 de/serialization

Code Examples Basic usage

 git clone git@github.com:rust-bitcoin/rust-bitcoin.git
cd rust-bitcoin
cargo build

Run tests

 cargo test

No-std support

 To build this project without the Rust standard library, use the --no-default-features flag or set default-features = false in your dependency declaration.

Building the docs

 RUSTDOCFLAGS="--cfg docsrs" cargo +nightly rustdoc --features="$FEATURES" -- -D rustdoc::broken-intra-doc-links

Run benchmarks

 RUSTFLAGS='--cfg=bench' cargo +nightly bench

Linkshttps://crates.io/crates/bitcoinhttps://github.com/rust-bitcoin/rust-bitcoin/blob/master/LICENSEhttps://docs.rs/bitcoinhttps://github.com/rust-bitcoin/rust-bitcoincore-rpchttps://gnusha.org/bitcoin-rust/https://github.com/rust-bitcoin/rust-bitcoin/pull/14https://github.com/rust-bitcoin/rust-bitcoin/pull/18https://github.com/rust-bitcoin/rust-bitcoin/pull/22https://github.com/rust-bitcoin/rust-bitcoin/pull/25https://github.com/rust-bitcoin/rust-bitcoin/pull/29https://github.com/rust-bitcoin/rust-bitcoin/pull/32https://github.com/rust-bitcoin/rust-bitcoin/pull/33https://github.com/rust-bitcoin/rust-bitcoin/pull/34https://github.com/rust-bitcoin/rust-bitcoin/pull/35https://github.com/rust-bitcoin/rust-bitcoin/pull/46https://github.com/rust-bitcoin/rust-bitcoin/pull/58https://github.com/rust-bitcoin/rust-bitcoin/pull/60https://github.com/rust-bitcoin/rust-bitcoin/pull/62https://github.com/rust-bitcoin/rust-bitcoin/pull/65 https://docs.rs/bitcoin_hashes/ https://api.github.com/repos/rust-bitcoin/rust-bitcoin/releases/125101316

Release info

Release version: 0.17.0

Release description Version 0.17.0 introduces several significant updates and enhancements to the rust-bitcoin project. Key changes include replacing the use of time with std::time, strengthening the library by fixing vulnerabilities discovered through cargo audit, and adding new features like the GetAddr message. Additional changes include improved function sets in the script, such as to_p2wsh() and is_p2swsh(), and the introduction of new modules like bip143 for creating BIP143 signature hashes. The updates also include a more robust transaction structure, with the addition of the txid() method and improvements to existing methods, enhancing the library's utility for developers. The removal of deprecated functions, updates to documentation, and better handling of mem::uninitialized contribute to cleaner, more maintainable code. Notably, several contributions from new developers have also been acknowledged, which reflects a growing community around the project. For a complete list of contributions and code changes, see the full changelog.

Code Examples Fix vulnerabilities reported by cargo audit

// Ensuring vulnerabilities are addressed by running...
cargo audit

New GetAddr message example

let message = GetAddr::new();
// Now you can use message in your application

Implementation of txid() method

impl Transaction {
   pub fn txid(&self) -> Txid {
       // Calculate the transaction ID based on current transaction data
   }
}

Patch update: 0.18.0 → 0.18.0

$ DOWNLOADS TREND

21.7M24.3M

$ VERSION HISTORY

v0.18.0December 4, 2025
v0.18.0December 1, 2025
v0.17.0October 17, 2025
v0.16.0December 17, 2024

$ LINKS

$ INSTALL

cargo add bitcoin_hashes

Or add to Cargo.toml: bitcoin_hashes = "0.18.0"