Function hash_cgid

Source
pub fn hash_cgid(cgid: &str) -> u64
Expand description

Utilizes xxHash to hash a cgid into a 64 bit number and returns that number.

Passing an empty string as the cgid will result in 0 being returned instead of the hash of cgid.

ยงExamples

use amazon_cloudfront_client_routing_lib::hash::hash_cgid;

// valid cgid
let mut hashed_cgid = hash_cgid("f3663718-7699-4e6e-b482-daa2f690cf64");
assert_eq!(8517775255794402596, hashed_cgid);

// empty cgid
hashed_cgid = hash_cgid("");
assert_eq!(0, hashed_cgid);