widevin 0.3.0

Lightweight Rust Devin provider library
Documentation
1
2
3
4
5
6
7
8
9
10
11
use sha2::{Digest, Sha256};
use uuid::Uuid;

pub fn deterministic_uuid(seed: &str) -> String {
    let digest = Sha256::digest(seed.as_bytes());
    let mut bytes = [0_u8; 16];
    bytes.copy_from_slice(&digest[..16]);
    bytes[6] = (bytes[6] & 0x0f) | 0x50;
    bytes[8] = (bytes[8] & 0x3f) | 0x80;
    Uuid::from_bytes(bytes).to_string()
}