From 71a049297f05187ebd1d2ee5d4db3ded078f270b Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Mon, 29 Apr 2024 15:05:48 +1000 Subject: [PATCH] Depend on new chf crate --- Cargo.toml | 10 +++++----- contrib/_test.sh | 10 +++++----- examples/sign_verify.rs | 5 +---- examples/sign_verify_recovery.rs | 5 +---- src/ecdh.rs | 4 ++-- 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a1958d945..d0ae1de18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ default = ["std"] std = ["alloc", "secp256k1-sys/std"] # allow use of Secp256k1::new and related API that requires an allocator alloc = ["secp256k1-sys/alloc"] -hashes-std = ["std", "hashes/std"] +chf-std = ["std", "chf/std"] rand-std = ["std", "rand", "rand/std", "rand/std_rng"] recovery = ["secp256k1-sys/recovery"] lowmemory = ["secp256k1-sys/lowmemory"] @@ -40,8 +40,8 @@ secp256k1-sys = { version = "0.10.0", default-features = false, path = "./secp25 serde = { version = "1.0.103", default-features = false, optional = true } # You likely only want to enable these if you explicitly do not want to use "std", otherwise enable -# the respective -std feature e.g., hashes-std -hashes = { package = "bitcoin_hashes", version = ">= 0.12, <= 0.14", default-features = false, optional = true } +# the respective -std feature e.g., chf-std +chf = { package = "chf", version = "0.2.0", default-features = false, optional = true } rand = { version = "0.8", default-features = false, optional = true } [dev-dependencies] @@ -57,11 +57,11 @@ getrandom = { version = "0.2", features = ["js"] } [[example]] name = "sign_verify_recovery" -required-features = ["recovery", "hashes-std"] +required-features = ["recovery", "chf-std"] [[example]] name = "sign_verify" -required-features = ["hashes-std"] +required-features = ["chf-std"] [[example]] name = "generate_keys" diff --git a/contrib/_test.sh b/contrib/_test.sh index e18b23146..860abb3d0 100755 --- a/contrib/_test.sh +++ b/contrib/_test.sh @@ -3,7 +3,7 @@ set -ex REPO_DIR=$(git rev-parse --show-toplevel) -FEATURES="hashes global-context lowmemory rand recovery serde std alloc hashes-std rand-std" +FEATURES="chf global-context lowmemory rand recovery serde std alloc chf-std rand-std" cargo --version rustc --version @@ -62,16 +62,16 @@ if [ "$DO_FEATURE_MATRIX" = true ]; then fi # Examples - cargo run --locked --example sign_verify --features=hashes-std - cargo run --locked --example sign_verify_recovery --features=recovery,hashes-std + cargo run --locked --example sign_verify --features=chf-std + cargo run --locked --example sign_verify_recovery --features=recovery,chf-std cargo run --locked --example generate_keys --features=rand-std fi if [ "$DO_LINT" = true ] then cargo clippy --locked --all-features --all-targets -- -D warnings - cargo clippy --locked --example sign_verify --features=hashes-std -- -D warnings - cargo clippy --locked --example sign_verify_recovery --features=recovery,hashes-std -- -D warnings + cargo clippy --locked --example sign_verify --features=chf-std -- -D warnings + cargo clippy --locked --example sign_verify_recovery --features=recovery,chf-std -- -D warnings cargo clippy --locked --example generate_keys --features=rand-std -- -D warnings fi diff --git a/examples/sign_verify.rs b/examples/sign_verify.rs index 46d90e11d..12caa1d9a 100644 --- a/examples/sign_verify.rs +++ b/examples/sign_verify.rs @@ -1,7 +1,4 @@ -extern crate hashes; -extern crate secp256k1; - -use hashes::{sha256, Hash}; +use chf::sha256; use secp256k1::{ecdsa, Error, Message, PublicKey, Secp256k1, SecretKey, Signing, Verification}; fn verify( diff --git a/examples/sign_verify_recovery.rs b/examples/sign_verify_recovery.rs index 2ab43ea06..3828c2b36 100644 --- a/examples/sign_verify_recovery.rs +++ b/examples/sign_verify_recovery.rs @@ -1,7 +1,4 @@ -extern crate hashes; -extern crate secp256k1; - -use hashes::{sha256, Hash}; +use chf::sha256; use secp256k1::{ecdsa, Error, Message, PublicKey, Secp256k1, SecretKey, Signing, Verification}; fn recover( diff --git a/src/ecdh.rs b/src/ecdh.rs index e53dd79dd..b9b98292a 100644 --- a/src/ecdh.rs +++ b/src/ecdh.rs @@ -112,7 +112,7 @@ impl AsRef<[u8]> for SharedSecret { /// ``` /// # #[cfg(all(feature = "hashes-std", feature = "rand-std"))] { /// # use secp256k1::{ecdh, rand, Secp256k1, PublicKey, SecretKey}; -/// # use secp256k1::hashes::{Hash, sha512}; +/// # use secp256k1::hashes::sha512; /// /// let s = Secp256k1::new(); /// let (sk1, pk1) = s.generate_keypair(&mut rand::thread_rng()); @@ -227,7 +227,7 @@ mod tests { #[cfg(not(secp256k1_fuzz))] #[cfg(all(feature = "hashes-std", feature = "rand-std"))] fn hashes_and_sys_generate_same_secret() { - use hashes::{sha256, Hash, HashEngine}; + use hashes::{sha256, HashEngine}; use crate::ecdh::shared_secret_point;