zero-trust-rps 0.0.5

Online Multiplayer Rock Paper Scissors
Documentation
use rand::RngCore;
use uuid::Uuid;

use super::blake3::B3Hash;

#[allow(unused)]
pub fn get_random_bytes<const L: usize>() -> [u8; L] {
    let mut data = [0; L];
    rand::thread_rng().fill_bytes(&mut data);
    data
}

/// IT should be sorted
pub fn hash_users<IT: Iterator<Item = Uuid>>(it: IT) -> B3Hash {
    let mut hasher = blake3::Hasher::new();
    for uuid in it {
        hasher.update(uuid.as_bytes());
    }
    hasher.finalize().into()
}