summaryrefslogtreecommitdiffstats
path: root/vendor/uuid/src/sha1.rs
blob: 14ca302f280822d0d825e45e575198532543a35c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#[cfg(feature = "v5")]
pub(crate) fn hash(ns: &[u8], src: &[u8]) -> [u8; 16] {
    use sha1_smol::Sha1;

    let mut hasher = Sha1::new();

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

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

    bytes
}