rust-bitcoin-unsafe-fast/hashes
Andrew Poelstra 9b2e1c591a
Merge rust-bitcoin/rust-bitcoin#2165: Use macro to define `sha512::Hash`
71454d438a Use hash_type macro for sha512::Hash (Tobin C. Harding)
d51c1857fd sha512: Move from_engine functions (Tobin C. Harding)

Pull request description:

  This PR does not introduce any logic changes.

  - Patch 1 is a code move.
  - Patch 2 uses the `hash_type!` macro to define the `sha512::Hash` type.

ACKs for top commit:
  Kixunil:
    ACK 71454d438a
  apoelstra:
    ACK 71454d438a

Tree-SHA512: c0148391fbea3602f0c52e5e08883faac6b5cb3f75ae62bfb53b1d2762e28871d349b3d3fb589f59d8bf2912dd63934f8f9a6fe6390afd378e5391eb2c91c237
2023-11-03 21:11:49 +00:00
..
contrib Add wasm dev-deps using CI script 2023-10-05 11:16:24 +11:00
embedded hashes/embedded: Add script dir and README 2023-07-18 10:27:48 +10:00
extended_tests/schemars schemars: Add pinning docs 2023-07-18 10:27:48 +10:00
src Merge rust-bitcoin/rust-bitcoin#2165: Use macro to define `sha512::Hash` 2023-11-03 21:11:49 +00:00
CHANGELOG.md hashes: Remove duplicate entry 2023-09-07 14:19:01 -04:00
Cargo.toml Add wasm dev-deps using CI script 2023-10-05 11:16:24 +11:00
README.md hashes: Remove stale status badge 2023-05-25 14:34:28 +10:00

README.md

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 ancilliary thing, it exposes hexadecimal serialization and deserialization, since these are needed to display hashes anway.

Documentation

Minimum Supported Rust Version (MSRV)

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

To build with the MSRV you will need to pin serde (if you have either the serde or the schemars feature enabled)

# serde 1.0.157 uses syn 2.0 which requires edition 2021
cargo update -p serde --precise 1.0.156

before building. (And if your code is a library, your downstream users will need to run these commands, and so on.)

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 bench mark code. To run the bench marks use: RUSTFLAGS='--cfg=bench' cargo +nightly bench.