scsys_crypto/utils/
convert.rs

1/*
2    Appellation: convert <module>
3    Contrib: @FL03
4*/
5
6/// Utility functions for converting between different cryptographic representations
7pub fn digest_to_hash<const N: usize>(hash: impl AsRef<[u8]>) -> [u8; N] {
8    let mut raw_hash: [u8; N] = [0; N];
9    raw_hash[0..N].copy_from_slice(hash.as_ref());
10    raw_hash
11}