Skip to content

Commit

Permalink
Merge rust-bitcoin#4003: Add engine function to siphash24::Hash
Browse files Browse the repository at this point in the history
51cb368 api: Run just check-api (Tobin C. Harding)
1bcfc80 Add engine function to siphash24::Hash (Tobin C. Harding)

Pull request description:

  The other hashes that require initial state (keys etc) both have an `engine` function on the hash type because they cannot use the `GeneralHash::engine` function.

  Add an `engine` function to the `siphash24::Hash` type.

ACKs for top commit:
  apoelstra:
    ACK 51cb368; successfully ran local tests

Tree-SHA512: 5cafa5b717235e94167b98a7ff675c3bde5071e736cdc4515ae534b517a5a96eead2bebd25b5dc0123e5e8615bb191c6990ae1ea7dea59b1b58d72547514b5b5
  • Loading branch information
apoelstra committed Feb 3, 2025
2 parents f81d10b + 51cb368 commit 511ac2c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/hashes/all-features.txt
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,7 @@ pub fn bitcoin_hashes::siphash24::Hash::borrow(&self) -> &[u8]
pub fn bitcoin_hashes::siphash24::Hash::clone(&self) -> bitcoin_hashes::siphash24::Hash
pub fn bitcoin_hashes::siphash24::Hash::cmp(&self, other: &bitcoin_hashes::siphash24::Hash) -> core::cmp::Ordering
pub fn bitcoin_hashes::siphash24::Hash::deserialize<D: serde::de::Deserializer<'de>>(d: D) -> core::result::Result<bitcoin_hashes::siphash24::Hash, <D as serde::de::Deserializer>::Error>
pub fn bitcoin_hashes::siphash24::Hash::engine(k0: u64, k1: u64) -> bitcoin_hashes::siphash24::HashEngine
pub fn bitcoin_hashes::siphash24::Hash::eq(&self, other: &bitcoin_hashes::siphash24::Hash) -> bool
pub fn bitcoin_hashes::siphash24::Hash::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub fn bitcoin_hashes::siphash24::Hash::from_byte_array(bytes: Self::Bytes) -> Self
Expand Down
1 change: 1 addition & 0 deletions api/hashes/alloc-only.txt
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,7 @@ pub fn bitcoin_hashes::siphash24::Hash::borrow(&self) -> &[u8; 8]
pub fn bitcoin_hashes::siphash24::Hash::borrow(&self) -> &[u8]
pub fn bitcoin_hashes::siphash24::Hash::clone(&self) -> bitcoin_hashes::siphash24::Hash
pub fn bitcoin_hashes::siphash24::Hash::cmp(&self, other: &bitcoin_hashes::siphash24::Hash) -> core::cmp::Ordering
pub fn bitcoin_hashes::siphash24::Hash::engine(k0: u64, k1: u64) -> bitcoin_hashes::siphash24::HashEngine
pub fn bitcoin_hashes::siphash24::Hash::eq(&self, other: &bitcoin_hashes::siphash24::Hash) -> bool
pub fn bitcoin_hashes::siphash24::Hash::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub fn bitcoin_hashes::siphash24::Hash::from_byte_array(bytes: Self::Bytes) -> Self
Expand Down
1 change: 1 addition & 0 deletions api/hashes/no-features.txt
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@ pub fn bitcoin_hashes::siphash24::Hash::borrow(&self) -> &[u8; 8]
pub fn bitcoin_hashes::siphash24::Hash::borrow(&self) -> &[u8]
pub fn bitcoin_hashes::siphash24::Hash::clone(&self) -> bitcoin_hashes::siphash24::Hash
pub fn bitcoin_hashes::siphash24::Hash::cmp(&self, other: &bitcoin_hashes::siphash24::Hash) -> core::cmp::Ordering
pub fn bitcoin_hashes::siphash24::Hash::engine(k0: u64, k1: u64) -> bitcoin_hashes::siphash24::HashEngine
pub fn bitcoin_hashes::siphash24::Hash::eq(&self, other: &bitcoin_hashes::siphash24::Hash) -> bool
pub fn bitcoin_hashes::siphash24::Hash::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
pub fn bitcoin_hashes::siphash24::Hash::from_byte_array(bytes: Self::Bytes) -> Self
Expand Down
3 changes: 3 additions & 0 deletions hashes/src/siphash24.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ impl crate::HashEngine for HashEngine {
}

impl Hash {
/// Constructs a new SipHash24 engine with keys.
pub fn engine(k0: u64, k1: u64) -> HashEngine { HashEngine::with_keys(k0, k1) }

/// Produces a hash from the current state of a given engine.
pub fn from_engine(e: HashEngine) -> Hash { from_engine(e) }

Expand Down

0 comments on commit 511ac2c

Please sign in to comment.