use hex_simd::AsciiCase;
use md5::{Digest, Md5};
use sha2::Sha256;

pub(crate) fn md5_hex<T>(data: T, ascii_case: AsciiCase) -> String
where
    T: AsRef<[u8]>,
{
    hex_simd::encode_to_string(Md5::digest(data.as_ref()), ascii_case)
}

pub(crate) fn sha256<T>(data: T) -> Vec<u8>
where
    T: AsRef<[u8]>,
{
    Sha256::digest(data.as_ref()).to_vec()
}
