Skip to content

Commit

Permalink
Depend on new chf crate
Browse files Browse the repository at this point in the history
  • Loading branch information
tcharding committed May 2, 2024
1 parent 6648126 commit e043576
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 20 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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.1.0", default-features = false, optional = true }
rand = { version = "0.8", default-features = false, optional = true }

[dev-dependencies]
Expand All @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions contrib/_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
5 changes: 1 addition & 4 deletions examples/sign_verify.rs
Original file line number Diff line number Diff line change
@@ -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<C: Verification>(
Expand Down
5 changes: 1 addition & 4 deletions examples/sign_verify_recovery.rs
Original file line number Diff line number Diff line change
@@ -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<C: Verification>(
Expand Down
4 changes: 2 additions & 2 deletions src/ecdh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit e043576

Please sign in to comment.