Skip to content

Commit 8e77249

Browse files
committed
Depend on bitcoin_hashes v0.12
Upgrade to use the newly released `bitcoin_hashes`.
1 parent c931088 commit 8e77249

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ serde = { version = "1.0", default-features = false, optional = true }
4242

4343
# You likely only want to enable these if you explicitly do not want to use "std", otherwise enable
4444
# the respective -std feature e.g., bitcoin-hashes-std
45-
bitcoin_hashes = { version = "0.11", default-features = false, optional = true }
45+
bitcoin_hashes = { version = "0.12", default-features = false, optional = true }
4646
rand = { version = "0.8", default-features = false, optional = true }
4747

4848
[dev-dependencies]

examples/sign_verify.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn verify<C: Verification>(
1111
pubkey: [u8; 33],
1212
) -> Result<bool, Error> {
1313
let msg = sha256::Hash::hash(msg);
14-
let msg = Message::from_slice(&msg)?;
14+
let msg = Message::from_slice(msg.as_ref())?;
1515
let sig = ecdsa::Signature::from_compact(&sig)?;
1616
let pubkey = PublicKey::from_slice(&pubkey)?;
1717

@@ -24,7 +24,7 @@ fn sign<C: Signing>(
2424
seckey: [u8; 32],
2525
) -> Result<ecdsa::Signature, Error> {
2626
let msg = sha256::Hash::hash(msg);
27-
let msg = Message::from_slice(&msg)?;
27+
let msg = Message::from_slice(msg.as_ref())?;
2828
let seckey = SecretKey::from_slice(&seckey)?;
2929
Ok(secp.sign_ecdsa(&msg, &seckey))
3030
}

examples/sign_verify_recovery.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn recover<C: Verification>(
1111
recovery_id: u8,
1212
) -> Result<PublicKey, Error> {
1313
let msg = sha256::Hash::hash(msg);
14-
let msg = Message::from_slice(&msg)?;
14+
let msg = Message::from_slice(msg.as_ref())?;
1515
let id = ecdsa::RecoveryId::from_i32(recovery_id as i32)?;
1616
let sig = ecdsa::RecoverableSignature::from_compact(&sig, id)?;
1717

@@ -24,7 +24,7 @@ fn sign_recovery<C: Signing>(
2424
seckey: [u8; 32],
2525
) -> Result<ecdsa::RecoverableSignature, Error> {
2626
let msg = sha256::Hash::hash(msg);
27-
let msg = Message::from_slice(&msg)?;
27+
let msg = Message::from_slice(msg.as_ref())?;
2828
let seckey = SecretKey::from_slice(&seckey)?;
2929
Ok(secp.sign_ecdsa_recoverable(&msg, &seckey))
3030
}

src/ecdh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ mod tests {
260260
engine.input(&xy.as_ref()[..32]);
261261
let secret_bh = sha256::Hash::from_engine(engine);
262262

263-
assert_eq!(secret_bh.as_inner(), secret_sys.as_ref());
263+
assert_eq!(secret_bh.as_byte_array(), secret_sys.as_ref());
264264
}
265265

266266
#[test]

src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,19 +216,19 @@ pub trait ThirtyTwoByteHash {
216216
#[cfg(feature = "bitcoin_hashes")]
217217
#[cfg_attr(docsrs, doc(cfg(feature = "bitcoin-hashes")))]
218218
impl ThirtyTwoByteHash for hashes::sha256::Hash {
219-
fn into_32(self) -> [u8; 32] { self.into_inner() }
219+
fn into_32(self) -> [u8; 32] { self.to_byte_array() }
220220
}
221221

222222
#[cfg(feature = "bitcoin_hashes")]
223223
#[cfg_attr(docsrs, doc(cfg(feature = "bitcoin-hashes")))]
224224
impl ThirtyTwoByteHash for hashes::sha256d::Hash {
225-
fn into_32(self) -> [u8; 32] { self.into_inner() }
225+
fn into_32(self) -> [u8; 32] { self.to_byte_array() }
226226
}
227227

228228
#[cfg(feature = "bitcoin_hashes")]
229229
#[cfg_attr(docsrs, doc(cfg(feature = "bitcoin-hashes")))]
230230
impl<T: hashes::sha256t::Tag> ThirtyTwoByteHash for hashes::sha256t::Hash<T> {
231-
fn into_32(self) -> [u8; 32] { self.into_inner() }
231+
fn into_32(self) -> [u8; 32] { self.to_byte_array() }
232232
}
233233

234234
/// A (hashed) message input to an ECDSA signature.
@@ -1046,12 +1046,12 @@ mod tests {
10461046

10471047
let hash = hashes::sha256::Hash::hash(test_bytes);
10481048
let msg = Message::from(hash);
1049-
assert_eq!(msg.0, hash.into_inner());
1049+
assert_eq!(msg.0, hash.to_byte_array());
10501050
assert_eq!(msg, Message::from_hashed_data::<hashes::sha256::Hash>(test_bytes));
10511051

10521052
let hash = hashes::sha256d::Hash::hash(test_bytes);
10531053
let msg = Message::from(hash);
1054-
assert_eq!(msg.0, hash.into_inner());
1054+
assert_eq!(msg.0, hash.to_byte_array());
10551055
assert_eq!(msg, Message::from_hashed_data::<hashes::sha256d::Hash>(test_bytes));
10561056
}
10571057
}

0 commit comments

Comments
 (0)