Skip to navigation
Example for the fastest way to create an 8char hash from a string in rust
23.10.25
``` use std::collections::hash_map::DefaultHasher; use std::hash::{Hash, Hasher}; fn hash8(s: &str) -> String { let mut hasher = DefaultHasher::new(); s.hash(&mut hasher); let hash = hasher.finish(); format!("{:016x}", hash)[..8].to_string() } fn main() { let input = "your string here"; let h = hash8(input); println!("{}", h); // Prints 8-char hash } ```
Reply
Anonymous
Information Epoch 1761522732
Make every program a filter.
Home
Notebook
Contact us