summaryrefslogtreecommitdiffstats
path: root/third_party/rust/uuid/src/md5.rs
blob: fce5d9b8726a059de07d148299ce38f846d5f5b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#[cfg(feature = "v3")]
pub(crate) fn hash(ns: &[u8], src: &[u8]) -> [u8; 16] {
    use md_5::{Digest, Md5};

    let mut hasher = Md5::new();

    hasher.update(ns);
    hasher.update(src);

    let mut bytes = [0; 16];
    bytes.copy_from_slice(&hasher.finalize()[..16]);

    bytes
}