Use a fixed-width stack-allocated array to prepare Equihash indices for hashing

This commit is contained in:
str4d 2018-04-25 18:30:37 +01:00
parent 8b8ece69cd
commit d7a93a03e6
No known key found for this signature in database
GPG Key ID: 1B8D649257DB0829
1 changed files with 2 additions and 2 deletions

View File

@ -96,8 +96,8 @@ fn initialise_state(n: u32, k: u32, digest_len: u8) -> Blake2b {
}
fn generate_hash(base_state: &Blake2b, i: u32) -> Blake2bResult {
let mut lei = vec![];
lei.write_u32::<LittleEndian>(i).unwrap();
let mut lei = [0u8; 4];
(&mut lei[..]).write_u32::<LittleEndian>(i).unwrap();
let mut state = base_state.clone();
state.update(&lei);