headless_lms_utils/
page_visit_hasher.rs1use uuid::Uuid;
2
3pub fn hash_anonymous_identifier(
4 course_id: Uuid,
5 hashing_key_for_the_day: Vec<u8>,
6 user_agent: String,
7 ip_address: String,
8) -> anyhow::Result<String> {
9 let mut hasher = blake3::Hasher::new();
10 hasher.update(course_id.as_bytes());
11 hasher.update(&hashing_key_for_the_day);
12 hasher.update(ip_address.as_bytes());
13 hasher.update(user_agent.as_bytes());
14 let hash = hasher.finalize();
15 let res = hash.to_hex().to_string();
16 Ok(res)
17}