Skip to content

Commit

Permalink
Merge pull request RustCrypto#129 from RustCrypto/universal-hash/rena…
Browse files Browse the repository at this point in the history
…me-update-block-to-update

universal-hash: rename `update_block` => `update`
  • Loading branch information
tarcieri committed May 23, 2020
2 parents dcbdbbc + 9a611e8 commit baea98a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions universal-hash/src/lib.rs
Expand Up @@ -48,7 +48,7 @@ pub trait UniversalHash: Clone {
fn new(key: &Key<Self>) -> Self;

/// Input a block into the universal hash function
fn update_block(&mut self, block: &Block<Self>);
fn update(&mut self, block: &Block<Self>);

/// Input data into the universal hash function. If the length of the
/// data is not a multiple of the block size, the remaining data is
Expand All @@ -60,15 +60,15 @@ pub trait UniversalHash: Clone {
let mut chunks = data.chunks_exact(Self::BlockSize::to_usize());

for chunk in &mut chunks {
self.update_block(GenericArray::from_slice(chunk));
self.update(GenericArray::from_slice(chunk));
}

let rem = chunks.remainder();

if !rem.is_empty() {
let mut padded_block = GenericArray::default();
padded_block[..rem.len()].copy_from_slice(rem);
self.update_block(&padded_block);
self.update(&padded_block);
}
}

Expand Down

0 comments on commit baea98a

Please sign in to comment.