Remove bytes
dependency from shuffling
This commit is contained in:
parent
514ac23724
commit
31a7a0614e
@ -15,6 +15,5 @@ hex = "0.3"
|
|||||||
ethereum-types = "0.5"
|
ethereum-types = "0.5"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bytes = "0.4"
|
|
||||||
hashing = { path = "../hashing" }
|
hashing = { path = "../hashing" }
|
||||||
int_to_bytes = { path = "../int_to_bytes" }
|
int_to_bytes = { path = "../int_to_bytes" }
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
use bytes::Buf;
|
|
||||||
use hashing::hash;
|
use hashing::hash;
|
||||||
use int_to_bytes::int_to_bytes4;
|
use int_to_bytes::int_to_bytes4;
|
||||||
use std::io::Cursor;
|
|
||||||
|
|
||||||
const SEED_SIZE: usize = 32;
|
const SEED_SIZE: usize = 32;
|
||||||
const ROUND_SIZE: usize = 1;
|
const ROUND_SIZE: usize = 1;
|
||||||
@ -117,9 +115,10 @@ pub fn shuffle_list(
|
|||||||
Some(input)
|
Some(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bytes_to_int64(bytes: &[u8]) -> u64 {
|
fn bytes_to_int64(slice: &[u8]) -> u64 {
|
||||||
let mut cursor = Cursor::new(bytes);
|
let mut bytes = [0; 8];
|
||||||
cursor.get_u64_le()
|
bytes.copy_from_slice(&slice[0..8]);
|
||||||
|
u64::from_le_bytes(bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Loading…
Reference in New Issue
Block a user