41
41
//! trigger any assertion failures in the upstream library.
42
42
//!
43
43
//! ```rust
44
- //! # #[cfg(all(feature = "std", feature="rand-std", feature="bitcoin_hashes "))] {
44
+ //! # #[cfg(all(feature = "std", feature="rand-std", feature="bitcoin-hashes-std "))] {
45
45
//! use secp256k1::rand::rngs::OsRng;
46
46
//! use secp256k1::{Secp256k1, Message};
47
47
//! use secp256k1::hashes::sha256;
58
58
//! If the "global-context" feature is enabled you have access to an alternate API.
59
59
//!
60
60
//! ```rust
61
- //! # #[cfg(all(feature="global-context", feature = "std", feature="rand-std", features = "bitcoin_hashes "))] {
61
+ //! # #[cfg(all(feature="global-context", feature = "std", feature="rand-std", features = "bitcoin-hashes-std "))] {
62
62
//! use secp256k1::rand::thread_rng;
63
63
//! use secp256k1::{generate_keypair, Message};
64
64
//! use secp256k1::hashes::sha256;
71
71
//! # }
72
72
//! ```
73
73
//!
74
- //! The above code requires `rust-secp256k1` to be compiled with the `rand-std` and `bitcoin_hashes `
74
+ //! The above code requires `rust-secp256k1` to be compiled with the `rand-std` and `bitcoin-hashes-std `
75
75
//! feature enabled, to get access to [`generate_keypair`](struct.Secp256k1.html#method.generate_keypair)
76
76
//! Alternately, keys and messages can be parsed from slices, like
77
77
//!
83
83
//! let secret_key = SecretKey::from_slice(&[0xcd; 32]).expect("32 bytes, within curve order");
84
84
//! let public_key = PublicKey::from_secret_key(&secp, &secret_key);
85
85
//! // This is unsafe unless the supplied byte slice is the output of a cryptographic hash function.
86
- //! // See the above example for how to use this library together with `bitcoin_hashes `.
86
+ //! // See the above example for how to use this library together with `bitcoin-hashes-std `.
87
87
//! let message = Message::from_slice(&[0xab; 32]).expect("32 bytes");
88
88
//!
89
89
//! let sig = secp.sign_ecdsa(&message, &secret_key);
141
141
//! * `alloc` - use the `alloc` standard Rust library to provide heap allocations.
142
142
//! * `rand` - use `rand` library to provide random generator (e.g. to generate keys).
143
143
//! * `rand-std` - use `rand` library with its `std` feature enabled. (Implies `rand`.)
144
+ //! * `bitcoin-hashes` - use the `bitcoin-hashes` library.
145
+ //! * `bitcoin-hashes-std` - use the `bitcoin-hashes` library with its `std` feature enabled (implies `bitcoin-hashes`).
144
146
//! * `recovery` - enable functions that can compute the public key from signature.
145
147
//! * `lowmemory` - optimize the library for low-memory environments.
146
148
//! * `global-context` - enable use of global secp256k1 context (implies `std`).
147
149
//! * `serde` - implements serialization and deserialization for types in this crate using `serde`.
148
150
//! **Important**: `serde` encoding is **not** the same as consensus encoding!
149
- //! * `bitcoin_hashes` - enables interaction with the `bitcoin-hashes` crate (e.g. conversions).
151
+ //!
150
152
151
153
// Coding conventions
152
154
#![ deny( non_upper_case_globals, non_camel_case_types, non_snake_case) ]
@@ -188,8 +190,8 @@ pub use rand;
188
190
#[ cfg( feature = "serde" ) ]
189
191
#[ cfg_attr( docsrs, doc( cfg( feature = "serde" ) ) ) ]
190
192
pub use serde;
191
- #[ cfg( feature = "bitcoin_hashes " ) ]
192
- #[ cfg_attr( docsrs, doc( cfg( feature = "bitcoin_hashes " ) ) ) ]
193
+ #[ cfg( feature = "bitcoin-hashes " ) ]
194
+ #[ cfg_attr( docsrs, doc( cfg( feature = "bitcoin-hashes " ) ) ) ]
193
195
pub use bitcoin_hashes as hashes;
194
196
pub use secp256k1_sys as ffi;
195
197
pub use crate :: key:: { PublicKey , SecretKey } ;
@@ -203,7 +205,7 @@ pub use context::global::SECP256K1;
203
205
204
206
use core:: { fmt, str, mem, marker:: PhantomData } ;
205
207
use crate :: ffi:: { CPtr , impl_array_newtype, types:: AlignedType } ;
206
- #[ cfg( feature = "bitcoin_hashes " ) ]
208
+ #[ cfg( feature = "bitcoin-hashes " ) ]
207
209
use crate :: hashes:: Hash ;
208
210
209
211
// Backwards compatible changes
@@ -233,24 +235,24 @@ pub trait ThirtyTwoByteHash {
233
235
fn into_32 ( self ) -> [ u8 ; 32 ] ;
234
236
}
235
237
236
- #[ cfg( feature = "bitcoin_hashes " ) ]
237
- #[ cfg_attr( docsrs, doc( cfg( feature = "bitcoin_hashes " ) ) ) ]
238
+ #[ cfg( feature = "bitcoin-hashes " ) ]
239
+ #[ cfg_attr( docsrs, doc( cfg( feature = "bitcoin-hashes " ) ) ) ]
238
240
impl ThirtyTwoByteHash for hashes:: sha256:: Hash {
239
241
fn into_32 ( self ) -> [ u8 ; 32 ] {
240
242
self . into_inner ( )
241
243
}
242
244
}
243
245
244
- #[ cfg( feature = "bitcoin_hashes " ) ]
245
- #[ cfg_attr( docsrs, doc( cfg( feature = "bitcoin_hashes " ) ) ) ]
246
+ #[ cfg( feature = "bitcoin-hashes " ) ]
247
+ #[ cfg_attr( docsrs, doc( cfg( feature = "bitcoin-hashes " ) ) ) ]
246
248
impl ThirtyTwoByteHash for hashes:: sha256d:: Hash {
247
249
fn into_32 ( self ) -> [ u8 ; 32 ] {
248
250
self . into_inner ( )
249
251
}
250
252
}
251
253
252
- #[ cfg( feature = "bitcoin_hashes " ) ]
253
- #[ cfg_attr( docsrs, doc( cfg( feature = "bitcoin_hashes " ) ) ) ]
254
+ #[ cfg( feature = "bitcoin-hashes " ) ]
255
+ #[ cfg_attr( docsrs, doc( cfg( feature = "bitcoin-hashes " ) ) ) ]
254
256
impl < T : hashes:: sha256t:: Tag > ThirtyTwoByteHash for hashes:: sha256t:: Hash < T > {
255
257
fn into_32 ( self ) -> [ u8 ; 32 ] {
256
258
self . into_inner ( )
@@ -299,8 +301,8 @@ impl Message {
299
301
/// assert_eq!(m1, m2);
300
302
/// # }
301
303
/// ```
302
- #[ cfg( feature = "bitcoin_hashes " ) ]
303
- #[ cfg_attr( docsrs, doc( cfg( feature = "bitcoin_hashes " ) ) ) ]
304
+ #[ cfg( feature = "bitcoin-hashes " ) ]
305
+ #[ cfg_attr( docsrs, doc( cfg( feature = "bitcoin-hashes " ) ) ) ]
304
306
pub fn from_hashed_data < H : ThirtyTwoByteHash + hashes:: Hash > ( data : & [ u8 ] ) -> Self {
305
307
<H as hashes:: Hash >:: hash ( data) . into ( )
306
308
}
@@ -1040,7 +1042,7 @@ mod tests {
1040
1042
assert ! ( SECP256K1 . verify_ecdsa( & msg, & sig, & pk) . is_ok( ) ) ;
1041
1043
}
1042
1044
1043
- #[ cfg( feature = "bitcoin_hashes " ) ]
1045
+ #[ cfg( feature = "bitcoin-hashes " ) ]
1044
1046
#[ test]
1045
1047
fn test_from_hash ( ) {
1046
1048
use crate :: hashes:: { self , Hash } ;
0 commit comments