2828//! trigger any assertion failures in the upstream library.
2929//!
3030//! ```rust
31- //! # #[cfg(all(feature = "rand-std", feature = "bitcoin- hashes-std"))] {
31+ //! # #[cfg(all(feature = "rand-std", feature = "hashes-std"))] {
3232//! use secp256k1::rand::rngs::OsRng;
3333//! use secp256k1::{Secp256k1, Message};
3434//! use secp256k1::hashes::sha256;
4545//! If the "global-context" feature is enabled you have access to an alternate API.
4646//!
4747//! ```rust
48- //! # #[cfg(all(feature = "global-context", feature = "bitcoin- hashes-std", feature = "rand-std"))] {
48+ //! # #[cfg(all(feature = "global-context", feature = "hashes-std", feature = "rand-std"))] {
4949//! use secp256k1::{generate_keypair, Message};
5050//! use secp256k1::hashes::sha256;
5151//!
5757//! # }
5858//! ```
5959//!
60- //! The above code requires `rust-secp256k1` to be compiled with the `rand-std` and `bitcoin- hashes-std`
60+ //! The above code requires `rust-secp256k1` to be compiled with the `rand-std` and `hashes-std`
6161//! feature enabled, to get access to [`generate_keypair`](struct.Secp256k1.html#method.generate_keypair)
6262//! Alternately, keys and messages can be parsed from slices, like
6363//!
6969//! let secret_key = SecretKey::from_slice(&[0xcd; 32]).expect("32 bytes, within curve order");
7070//! let public_key = PublicKey::from_secret_key(&secp, &secret_key);
7171//! // This is unsafe unless the supplied byte slice is the output of a cryptographic hash function.
72- //! // See the above example for how to use this library together with `bitcoin- hashes-std`.
72+ //! // See the above example for how to use this library together with `hashes-std`.
7373//! let message = Message::from_slice(&[0xab; 32]).expect("32 bytes");
7474//!
7575//! let sig = secp.sign_ecdsa(&message, &secret_key);
127127//! * `alloc` - use the `alloc` standard Rust library to provide heap allocations.
128128//! * `rand` - use `rand` library to provide random generator (e.g. to generate keys).
129129//! * `rand-std` - use `rand` library with its `std` feature enabled. (Implies `rand`.)
130- //! * `bitcoin- hashes` - use the `bitcoin_hashes ` library.
131- //! * `bitcoin- hashes-std` - use the `bitcoin_hashes ` library with its `std` feature enabled (implies `bitcoin- hashes`).
130+ //! * `hashes` - use the `hashes ` library.
131+ //! * `hashes-std` - use the `hashes ` library with its `std` feature enabled (implies `hashes`).
132132//! * `recovery` - enable functions that can compute the public key from signature.
133133//! * `lowmemory` - optimize the library for low-memory environments.
134134//! * `global-context` - enable use of global secp256k1 context (implies `std`).
@@ -151,6 +151,9 @@ extern crate core;
151151#[ cfg( bench) ]
152152extern crate test;
153153
154+ #[ cfg( feature = "hashes" ) ]
155+ pub extern crate hashes;
156+
154157#[ macro_use]
155158mod macros;
156159#[ macro_use]
@@ -170,8 +173,6 @@ use core::marker::PhantomData;
170173use core:: ptr:: NonNull ;
171174use core:: { fmt, mem, str} ;
172175
173- #[ cfg( feature = "bitcoin_hashes" ) ]
174- pub use bitcoin_hashes as hashes;
175176#[ cfg( feature = "global-context" ) ]
176177pub use context:: global:: SECP256K1 ;
177178#[ cfg( feature = "rand" ) ]
@@ -183,7 +184,7 @@ pub use serde;
183184pub use crate :: context:: * ;
184185use crate :: ffi:: types:: AlignedType ;
185186use crate :: ffi:: CPtr ;
186- #[ cfg( feature = "bitcoin_hashes " ) ]
187+ #[ cfg( feature = "hashes " ) ]
187188use crate :: hashes:: Hash ;
188189pub use crate :: key:: { PublicKey , SecretKey , * } ;
189190pub use crate :: scalar:: Scalar ;
@@ -196,17 +197,17 @@ pub trait ThirtyTwoByteHash {
196197 fn into_32 ( self ) -> [ u8 ; 32 ] ;
197198}
198199
199- #[ cfg( feature = "bitcoin_hashes " ) ]
200+ #[ cfg( feature = "hashes " ) ]
200201impl ThirtyTwoByteHash for hashes:: sha256:: Hash {
201202 fn into_32 ( self ) -> [ u8 ; 32 ] { self . to_byte_array ( ) }
202203}
203204
204- #[ cfg( feature = "bitcoin_hashes " ) ]
205+ #[ cfg( feature = "hashes " ) ]
205206impl ThirtyTwoByteHash for hashes:: sha256d:: Hash {
206207 fn into_32 ( self ) -> [ u8 ; 32 ] { self . to_byte_array ( ) }
207208}
208209
209- #[ cfg( feature = "bitcoin_hashes " ) ]
210+ #[ cfg( feature = "hashes " ) ]
210211impl < T : hashes:: sha256t:: Tag > ThirtyTwoByteHash for hashes:: sha256t:: Hash < T > {
211212 fn into_32 ( self ) -> [ u8 ; 32 ] { self . to_byte_array ( ) }
212213}
@@ -238,12 +239,12 @@ impl Message {
238239
239240 /// Constructs a [`Message`] by hashing `data` with hash algorithm `H`.
240241 ///
241- /// Requires the feature `bitcoin- hashes` to be enabled.
242+ /// Requires the feature `hashes` to be enabled.
242243 ///
243244 /// # Examples
244245 ///
245246 /// ```
246- /// # #[cfg(feature = "bitcoin_hashes ")] {
247+ /// # #[cfg(feature = "hashes ")] {
247248 /// use secp256k1::hashes::{sha256, Hash};
248249 /// use secp256k1::Message;
249250 ///
@@ -254,7 +255,7 @@ impl Message {
254255 /// assert_eq!(m1, m2);
255256 /// # }
256257 /// ```
257- #[ cfg( feature = "bitcoin_hashes " ) ]
258+ #[ cfg( feature = "hashes " ) ]
258259 pub fn from_hashed_data < H : ThirtyTwoByteHash + hashes:: Hash > ( data : & [ u8 ] ) -> Self {
259260 <H as hashes:: Hash >:: hash ( data) . into ( )
260261 }
@@ -1012,7 +1013,7 @@ mod tests {
10121013 assert ! ( SECP256K1 . verify_ecdsa( & msg, & sig, & pk) . is_ok( ) ) ;
10131014 }
10141015
1015- #[ cfg( feature = "bitcoin_hashes " ) ]
1016+ #[ cfg( feature = "hashes " ) ]
10161017 #[ test]
10171018 fn test_from_hash ( ) {
10181019 use crate :: hashes:: { self , Hash } ;
0 commit comments