mirror of
https://github.com/BLAKE3-team/BLAKE3
synced 2024-05-09 11:46:08 +02:00
Compare commits
3 Commits
9df78829cd
...
6770edb403
Author | SHA1 | Date | |
---|---|---|---|
Inanna Malick | 6770edb403 | ||
Jack O'Connor | 4ec3be8bfa | ||
Inanna Malick | 0031abcebd |
|
@ -78,23 +78,14 @@ fn compress(
|
|||
block_len: u32,
|
||||
flags: u32,
|
||||
) -> [u32; 16] {
|
||||
let counter_low = counter as u32;
|
||||
let counter_high = (counter >> 32) as u32;
|
||||
#[rustfmt::skip]
|
||||
let mut state = [
|
||||
chaining_value[0],
|
||||
chaining_value[1],
|
||||
chaining_value[2],
|
||||
chaining_value[3],
|
||||
chaining_value[4],
|
||||
chaining_value[5],
|
||||
chaining_value[6],
|
||||
chaining_value[7],
|
||||
IV[0],
|
||||
IV[1],
|
||||
IV[2],
|
||||
IV[3],
|
||||
counter as u32,
|
||||
(counter >> 32) as u32,
|
||||
block_len,
|
||||
flags,
|
||||
chaining_value[0], chaining_value[1], chaining_value[2], chaining_value[3],
|
||||
chaining_value[4], chaining_value[5], chaining_value[6], chaining_value[7],
|
||||
IV[0], IV[1], IV[2], IV[3],
|
||||
counter_low, counter_high, block_len, flags,
|
||||
];
|
||||
let mut block = *block_words;
|
||||
|
||||
|
|
|
@ -221,6 +221,12 @@ fn counter_high(counter: u64) -> u32 {
|
|||
#[derive(Clone, Copy, Hash)]
|
||||
pub struct Hash([u8; OUT_LEN]);
|
||||
|
||||
|
||||
/// Provided to allow for construction of magic hash values (eg null commit in git as [0; OUT_LEN])
|
||||
pub const fn construct_magic_hash(bytes: [u8; OUT_LEN]) -> Hash {
|
||||
Hash(bytes)
|
||||
}
|
||||
|
||||
impl Hash {
|
||||
/// The raw bytes of the `Hash`. Note that byte arrays don't provide
|
||||
/// constant-time equality checking, so if you need to compare hashes,
|
||||
|
|
Loading…
Reference in New Issue