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 Apr 29, 2024
1 parent 6648126 commit d2adde6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
13 changes: 8 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 All @@ -70,3 +70,6 @@ required-features = ["rand-std"]
[workspace]
members = ["secp256k1-sys"]
exclude = ["no_std_test"]

[patch.crates-io.chf]
path = "../../rust-chf"
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 d2adde6

Please sign in to comment.