Simple hash of a string to a u64.
(s: &str)
| 20 | |
| 21 | /// Simple hash of a string to a u64. |
| 22 | fn simple_hash(s: &str) -> u64 { |
| 23 | let mut h: u64 = 5381; |
| 24 | for b in s.bytes() { |
| 25 | h = h.wrapping_mul(33).wrapping_add(b as u64); |
| 26 | } |
| 27 | h |
| 28 | } |
| 29 | |
| 30 | /// Convert a target ID to a friendly "adjective-noun" name. |
| 31 | pub fn to_friendly(target_id: &str) -> String { |