|
40 | 40 | //! # #[cfg(all(feature="rand", feature="bitcoin_hashes"))] { |
41 | 41 | //! use secp256k1::rand::rngs::OsRng; |
42 | 42 | //! use secp256k1::{Secp256k1, Message}; |
43 | | -//! use secp256k1::bitcoin_hashes::sha256; |
| 43 | +//! use secp256k1::hashes::sha256; |
44 | 44 | //! |
45 | 45 | //! let secp = Secp256k1::new(); |
46 | 46 | //! let mut rng = OsRng::new().expect("OsRng"); |
|
126 | 126 | pub extern crate secp256k1_sys; |
127 | 127 | pub use secp256k1_sys as ffi; |
128 | 128 |
|
129 | | -#[cfg(feature = "bitcoin_hashes")] pub extern crate bitcoin_hashes; |
| 129 | +#[cfg(feature = "bitcoin_hashes")] pub extern crate bitcoin_hashes as hashes; |
130 | 130 | #[cfg(all(test, feature = "unstable"))] extern crate test; |
131 | 131 | #[cfg(any(test, feature = "rand"))] pub extern crate rand; |
132 | 132 | #[cfg(any(test))] extern crate rand_core; |
@@ -163,7 +163,7 @@ use ffi::{CPtr, types::AlignedType}; |
163 | 163 | pub use context::global::SECP256K1; |
164 | 164 |
|
165 | 165 | #[cfg(feature = "bitcoin_hashes")] |
166 | | -use bitcoin_hashes::Hash; |
| 166 | +use hashes::Hash; |
167 | 167 |
|
168 | 168 | /// An ECDSA signature |
169 | 169 | #[derive(Copy, Clone, PartialEq, Eq)] |
@@ -212,21 +212,21 @@ pub trait ThirtyTwoByteHash { |
212 | 212 | } |
213 | 213 |
|
214 | 214 | #[cfg(feature = "bitcoin_hashes")] |
215 | | -impl ThirtyTwoByteHash for bitcoin_hashes::sha256::Hash { |
| 215 | +impl ThirtyTwoByteHash for hashes::sha256::Hash { |
216 | 216 | fn into_32(self) -> [u8; 32] { |
217 | 217 | self.into_inner() |
218 | 218 | } |
219 | 219 | } |
220 | 220 |
|
221 | 221 | #[cfg(feature = "bitcoin_hashes")] |
222 | | -impl ThirtyTwoByteHash for bitcoin_hashes::sha256d::Hash { |
| 222 | +impl ThirtyTwoByteHash for hashes::sha256d::Hash { |
223 | 223 | fn into_32(self) -> [u8; 32] { |
224 | 224 | self.into_inner() |
225 | 225 | } |
226 | 226 | } |
227 | 227 |
|
228 | 228 | #[cfg(feature = "bitcoin_hashes")] |
229 | | -impl<T: bitcoin_hashes::sha256t::Tag> ThirtyTwoByteHash for bitcoin_hashes::sha256t::Hash<T> { |
| 229 | +impl<T: hashes::sha256t::Tag> ThirtyTwoByteHash for hashes::sha256t::Hash<T> { |
230 | 230 | fn into_32(self) -> [u8; 32] { |
231 | 231 | self.into_inner() |
232 | 232 | } |
@@ -497,8 +497,8 @@ impl Message { |
497 | 497 | /// assert_eq!(m1, m2); |
498 | 498 | /// ``` |
499 | 499 | #[cfg(feature = "bitcoin_hashes")] |
500 | | - pub fn from_hashed_data<H: ThirtyTwoByteHash + bitcoin_hashes::Hash>(data: &[u8]) -> Self { |
501 | | - <H as bitcoin_hashes::Hash>::hash(data).into() |
| 500 | + pub fn from_hashed_data<H: ThirtyTwoByteHash + hashes::Hash>(data: &[u8]) -> Self { |
| 501 | + <H as hashes::Hash>::hash(data).into() |
502 | 502 | } |
503 | 503 | } |
504 | 504 |
|
@@ -1291,25 +1291,25 @@ mod tests { |
1291 | 1291 | #[cfg(feature = "bitcoin_hashes")] |
1292 | 1292 | #[test] |
1293 | 1293 | fn test_from_hash() { |
1294 | | - use bitcoin_hashes; |
1295 | | - use bitcoin_hashes::Hash; |
| 1294 | + use hashes; |
| 1295 | + use hashes::Hash; |
1296 | 1296 |
|
1297 | 1297 | let test_bytes = "Hello world!".as_bytes(); |
1298 | 1298 |
|
1299 | | - let hash = bitcoin_hashes::sha256::Hash::hash(test_bytes); |
| 1299 | + let hash = hashes::sha256::Hash::hash(test_bytes); |
1300 | 1300 | let msg = Message::from(hash); |
1301 | 1301 | assert_eq!(msg.0, hash.into_inner()); |
1302 | 1302 | assert_eq!( |
1303 | 1303 | msg, |
1304 | | - Message::from_hashed_data::<bitcoin_hashes::sha256::Hash>(test_bytes) |
| 1304 | + Message::from_hashed_data::<hashes::sha256::Hash>(test_bytes) |
1305 | 1305 | ); |
1306 | 1306 |
|
1307 | | - let hash = bitcoin_hashes::sha256d::Hash::hash(test_bytes); |
| 1307 | + let hash = hashes::sha256d::Hash::hash(test_bytes); |
1308 | 1308 | let msg = Message::from(hash); |
1309 | 1309 | assert_eq!(msg.0, hash.into_inner()); |
1310 | 1310 | assert_eq!( |
1311 | 1311 | msg, |
1312 | | - Message::from_hashed_data::<bitcoin_hashes::sha256d::Hash>(test_bytes) |
| 1312 | + Message::from_hashed_data::<hashes::sha256d::Hash>(test_bytes) |
1313 | 1313 | ); |
1314 | 1314 | } |
1315 | 1315 | } |
|
0 commit comments