rust-bitcoin-unsafe-fast/hashes/Cargo.toml

45 lines
1.9 KiB
TOML
Raw Normal View History

[package]
name = "bitcoin_hashes"
version = "0.11.0"
authors = ["Andrew Poelstra <apoelstra@wpsoftware.net>"]
license = "CC0-1.0"
repository = "https://github.com/rust-bitcoin/bitcoin_hashes/"
documentation = "https://docs.rs/bitcoin_hashes/"
description = "Hash functions used by the rust-bitcoin eccosystem"
categories = ["algorithms"]
keywords = [ "crypto", "bitcoin", "hash", "digest" ]
readme = "README.md"
edition = "2018"
exclude = ["tests", "contrib"]
[features]
default = ["std"]
std = ["internals/alloc"]
schemars = ["actual-schemars", "dyn-clone"]
# If you disable std, you can still use a Write trait via the core2 feature.
# You can also use ToHex via the alloc feature, as it requires Vec/String.
# And you can still just disable std by disabling default features, without enabling these two.
alloc = ["core2/alloc", "internals/alloc"]
serde-std = ["serde/std"]
[dependencies]
# Only enable this if you explicitly do not want to use "std", otherwise enable "serde-std".
serde = { version = "1.0", default-features = false, optional = true }
# Only enable this if you explicitly do not want to use an allocator, otherwise enable "alloc".
core2 = { version = "0.3.0", optional = true, default_features = false }
Use hex from internals rather than hashes `bitcoin-internals` contains a more performant implementation of hex encoding than what `bitcoin_hashes` uses internally. This switches the implementations for formatting trait implementations as a step towards moving over completely. The public macros are also changed to delegate to inner type which is technically a breaking change but we will break the API anyway and the consuers should only call the macro on the actual hash newtypes where the inner types already have the appropriate implementations. Apart from removing reliance on internal hex from public API this reduces duplicated code generated and compiled. E.g. if you created 10 hash newtypes of SHA256 the formatting implementation would be instantiated 11 times despite being the same. To do all this some other changes were required to the hex infrastructure. Mainly modifying `put_bytes` to accept iterator (so that `iter().rev()` can be used) and adding a new `DisplayArray` type. The iterator idea was invented by Tobin C. Harding, this commit just adds a bound check and generalizes over `u8` and `&u8` returning iterators. While it may seem that `DisplayByteSlice` would suffice it'd create and initialize a large array even for small arrays wasting performance. Knowing the exact length `DisplayArray` fixes this. Another part of refactoring is changing from returning `impl Display` to return `impl LowerHex + UpperHex`. This makes selecting casing less annoying since the consumer no longer needs to import `Case` without cluttering the API with convenience methods.
2022-12-06 23:50:50 +00:00
# TODO: change to proper version before release
internals = { path = "../internals", package = "bitcoin-internals" }
# Do NOT use this as a feature! Use the `schemars` feature instead. Can only be used with "std" enabled.
actual-schemars = { package = "schemars", version = "<=0.8.3", optional = true }
# Do NOT enable this dependency, this is just to pin dyn-clone (transitive dep from schemars)
# because 1.0.8 does not build with Rust 1.41.1 (because of useage of `Arc::as_ptr`).
dyn-clone = { version = "<=1.0.7", default_features = false, optional = true }
[dev-dependencies]
serde_test = "1.0"
serde_json = "1.0"
[target.wasm32-unknown-unknown.dev-dependencies]
wasm-bindgen-test = "0.3"