Skip to content

Commit

Permalink
Merge #588: Bump version to 0.27.0
Browse files Browse the repository at this point in the history
4539519 Bump version to 0.27.0 (Tobin C. Harding)
8e77249 Depend on bitcoin_hashes v0.12 (Tobin C. Harding)

Pull request description:

  Depend on the newly released `bitcoin_hashes` version 0.12, add changelog, and bump to v0.27.0

ACKs for top commit:
  Kixunil:
    ACK 4539519
  apoelstra:
    ACK 4539519

Tree-SHA512: 9ea99c88a90d0d34dfbbd3e467ea77a2981a7eae75c52163eed805381683e7555ea841d9c953787ab878ce8848d26fd9a593bb2eb52b5be28cee3930a373434c
  • Loading branch information
apoelstra committed Mar 15, 2023
2 parents c931088 + 4539519 commit 1432fd1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.27.0 - 2023-13-15

* [Depend on newly release `bitcoin_hashes` v0.12](https://github.com/rust-bitcoin/rust-secp256k1/pull/588).
* [Implement `Debug` trait for `Scalar` type](https://github.com/rust-bitcoin/rust-secp256k1/pull/578).
* [Implement `insecure-erase`](https://github.com/rust-bitcoin/rust-secp256k1/pull/582).

# 0.26.0 - 2202-12-19

* Update libsecp25k1 to v0.2.0
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "secp256k1"
version = "0.26.0"
version = "0.27.0"
authors = [ "Dawid Ciężarkiewicz <dpc@ucore.info>",
"Andrew Poelstra <apoelstra@wpsoftware.net>" ]
license = "CC0-1.0"
Expand Down Expand Up @@ -42,7 +42,7 @@ serde = { version = "1.0", 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., bitcoin-hashes-std
bitcoin_hashes = { version = "0.11", default-features = false, optional = true }
bitcoin_hashes = { version = "0.12", default-features = false, optional = true }
rand = { version = "0.8", default-features = false, optional = true }

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions examples/sign_verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn verify<C: Verification>(
pubkey: [u8; 33],
) -> Result<bool, Error> {
let msg = sha256::Hash::hash(msg);
let msg = Message::from_slice(&msg)?;
let msg = Message::from_slice(msg.as_ref())?;
let sig = ecdsa::Signature::from_compact(&sig)?;
let pubkey = PublicKey::from_slice(&pubkey)?;

Expand All @@ -24,7 +24,7 @@ fn sign<C: Signing>(
seckey: [u8; 32],
) -> Result<ecdsa::Signature, Error> {
let msg = sha256::Hash::hash(msg);
let msg = Message::from_slice(&msg)?;
let msg = Message::from_slice(msg.as_ref())?;
let seckey = SecretKey::from_slice(&seckey)?;
Ok(secp.sign_ecdsa(&msg, &seckey))
}
Expand Down
4 changes: 2 additions & 2 deletions examples/sign_verify_recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn recover<C: Verification>(
recovery_id: u8,
) -> Result<PublicKey, Error> {
let msg = sha256::Hash::hash(msg);
let msg = Message::from_slice(&msg)?;
let msg = Message::from_slice(msg.as_ref())?;
let id = ecdsa::RecoveryId::from_i32(recovery_id as i32)?;
let sig = ecdsa::RecoverableSignature::from_compact(&sig, id)?;

Expand All @@ -24,7 +24,7 @@ fn sign_recovery<C: Signing>(
seckey: [u8; 32],
) -> Result<ecdsa::RecoverableSignature, Error> {
let msg = sha256::Hash::hash(msg);
let msg = Message::from_slice(&msg)?;
let msg = Message::from_slice(msg.as_ref())?;
let seckey = SecretKey::from_slice(&seckey)?;
Ok(secp.sign_ecdsa_recoverable(&msg, &seckey))
}
Expand Down
2 changes: 1 addition & 1 deletion src/ecdh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ mod tests {
engine.input(&xy.as_ref()[..32]);
let secret_bh = sha256::Hash::from_engine(engine);

assert_eq!(secret_bh.as_inner(), secret_sys.as_ref());
assert_eq!(secret_bh.as_byte_array(), secret_sys.as_ref());
}

#[test]
Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,19 +216,19 @@ pub trait ThirtyTwoByteHash {
#[cfg(feature = "bitcoin_hashes")]
#[cfg_attr(docsrs, doc(cfg(feature = "bitcoin-hashes")))]
impl ThirtyTwoByteHash for hashes::sha256::Hash {
fn into_32(self) -> [u8; 32] { self.into_inner() }
fn into_32(self) -> [u8; 32] { self.to_byte_array() }
}

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

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

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

let hash = hashes::sha256::Hash::hash(test_bytes);
let msg = Message::from(hash);
assert_eq!(msg.0, hash.into_inner());
assert_eq!(msg.0, hash.to_byte_array());
assert_eq!(msg, Message::from_hashed_data::<hashes::sha256::Hash>(test_bytes));

let hash = hashes::sha256d::Hash::hash(test_bytes);
let msg = Message::from(hash);
assert_eq!(msg.0, hash.into_inner());
assert_eq!(msg.0, hash.to_byte_array());
assert_eq!(msg, Message::from_hashed_data::<hashes::sha256d::Hash>(test_bytes));
}
}
Expand Down

0 comments on commit 1432fd1

Please sign in to comment.