rust-bitcoin-unsafe-fast/hashes
merge-script 0d9e8f8c99
Merge rust-bitcoin/rust-bitcoin#3204: Do many cleanups (and bug fix)
dae42bef9d do not enable bitcoin-io by default (Antoni Spaanderman)
a14cdaf859 don't enable std by default when testing (Antoni Spaanderman)
e83830dcfc use slice instead of array to not have to hardcode the length (Antoni Spaanderman)
55749d6f61 use `hash.to_byte_array` to check equality with `test.output` (Antoni Spaanderman)
969864e3b0 use fixed size array if possible, otherwise `&'static [u8]` (Antoni Spaanderman)
28ccf70fa6 remove unnecesarry borrow operator (`&`) (Antoni Spaanderman)
fa3a3afd02 remove unnecessary slicing (Antoni Spaanderman)
22e42ab86c fix test code being unnecessarily feature gated (Antoni Spaanderman)

Pull request description:

  - remove 2 unnecessary cfg attributes from tests left over from  #3167 (it made them not dependent on `alloc` anymore)
  - simplify assertion logic by removing unnecessary conversions before comparing
  - make tests `no_std` compatible by adding imports to alloc or std
  - feature gate tests behind the `alloc` feature if they use anything from the alloc crate (like the `format!` macro)
  - `schemars` feature enables `alloc` because (for example) its trait wants implementations to return `String`
  - fix `bitcoin-io` always enabling when `std` is enabled (only useful if people depend on `hashes` only, `bitcoin` depends on `bitcoin-io` already)

ACKs for top commit:
  tcharding:
    ACK dae42bef9d
  Kixunil:
    ACK dae42bef9d
  apoelstra:
    ACK dae42bef9d successfully ran local tests

Tree-SHA512: 622fd4963ef21530a98af89bcfc71abe8723aac12d363ab88d9bd30dcf2f75392711bec10e2901fab5f1a30e11897d1aae36e22892738aa1e5670166f91fddd4
2024-08-29 21:20:10 +00:00
..
contrib hashes: Pin in extra_test 2024-08-21 15:31:28 +10:00
embedded Change `T::from_str(s)` to `s.parse::<T>()` 2024-08-27 17:31:00 +01:00
extended_tests/schemars hashes: Pin in extra_test 2024-08-21 15:31:28 +10:00
src Merge rust-bitcoin/rust-bitcoin#3204: Do many cleanups (and bug fix) 2024-08-29 21:20:10 +00:00
tests Push up the Default bound on HashEngine 2024-07-31 13:13:51 -07:00
CHANGELOG.md Document the sha256t_hash_newtype direction 2024-05-07 12:48:07 +10:00
Cargo.toml do not enable bitcoin-io by default 2024-08-26 21:45:18 +02:00
README.md Bump MSRV to 1.63 2024-07-27 07:24:32 +02: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 ancillary 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.63.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 bench mark code. To run the bench marks use: RUSTFLAGS='--cfg=bench' cargo +nightly bench.