move name'calculation' into backend

This commit is contained in:
2025-08-02 20:55:26 +02:00
parent 88b13e215c
commit 5356557f7b
3 changed files with 35 additions and 11 deletions

View File

@@ -470,11 +470,11 @@ const NAMES: [&str; 467] = [
"Yellow",
];
pub(crate) fn get_name_by_uuid(uuid: &str) -> &str {
pub(crate) fn get_name_by_uuid(uuid: &str) -> String {
let mut hasher = DefaultHasher::new();
uuid.hash(&mut hasher);
let hash = hasher.finish();
let index = (hash % NAMES.len() as u64) as usize;
NAMES[index]
format!("Anonymous {}", NAMES[index])
}