Skip to content

Commit

Permalink
update sha3 for digest v0.11.0-pre
Browse files Browse the repository at this point in the history
  • Loading branch information
ok-ryoko committed May 16, 2023
1 parent 2763884 commit e40212b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion sha3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ keywords = ["crypto", "sha3", "keccak", "hash", "digest"]
categories = ["cryptography", "no-std"]

[dependencies]
digest = "0.10.4"
digest = "0.11.0-pre"
keccak = "0.1.4"

[dev-dependencies]
Expand Down
18 changes: 9 additions & 9 deletions sha3/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ macro_rules! impl_sha3 {
#[inline]
fn finalize_fixed_core(&mut self, buffer: &mut Buffer<Self>, out: &mut Output<Self>) {
let pos = buffer.get_pos();
let block = buffer.pad_with_zeros();
let mut block = buffer.pad_with_zeros();
block[pos] = $pad;
let n = block.len();
block[n - 1] |= 0x80;

self.state.absorb_block(block);
self.state.absorb_block(&block);

self.state.as_bytes(out);
}
Expand Down Expand Up @@ -135,12 +135,12 @@ macro_rules! impl_shake {
#[inline]
fn finalize_xof_core(&mut self, buffer: &mut Buffer<Self>) -> Self::ReaderCore {
let pos = buffer.get_pos();
let block = buffer.pad_with_zeros();
let mut block = buffer.pad_with_zeros();
block[pos] = $pad;
let n = block.len();
block[n - 1] |= 0x80;

self.state.absorb_block(block);
self.state.absorb_block(&block);
$reader {
state: self.state.clone(),
}
Expand Down Expand Up @@ -281,12 +281,12 @@ macro_rules! impl_turbo_shake {
#[inline]
fn finalize_xof_core(&mut self, buffer: &mut Buffer<Self>) -> Self::ReaderCore {
let pos = buffer.get_pos();
let block = buffer.pad_with_zeros();
let mut block = buffer.pad_with_zeros();
block[pos] = self.domain_separation;
let n = block.len();
block[n - 1] |= 0x80;

self.state.absorb_block(block);
self.state.absorb_block(&block);
$reader {
state: self.state.clone(),
}
Expand Down Expand Up @@ -427,7 +427,7 @@ macro_rules! impl_cshake {
state.absorb_block(block);
}
});
state.absorb_block(buffer.pad_with_zeros());
state.absorb_block(&buffer.pad_with_zeros());

Self {
padding: $cshake_pad,
Expand Down Expand Up @@ -463,12 +463,12 @@ macro_rules! impl_cshake {
#[inline]
fn finalize_xof_core(&mut self, buffer: &mut Buffer<Self>) -> Self::ReaderCore {
let pos = buffer.get_pos();
let block = buffer.pad_with_zeros();
let mut block = buffer.pad_with_zeros();
block[pos] = self.padding;
let n = block.len();
block[n - 1] |= 0x80;

self.state.absorb_block(block);
self.state.absorb_block(&block);
$reader {
state: self.state.clone(),
}
Expand Down

0 comments on commit e40212b

Please sign in to comment.