From 300a09e04bc1ffbc991175a0bbf7d3e905235191 Mon Sep 17 00:00:00 2001 From: ProofOfConcept Date: Sat, 28 Feb 2026 23:50:11 -0500 Subject: [PATCH] memory-search: hex-encode cookie instead of alphanumeric mapping --- src/bin/memory-search.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/bin/memory-search.rs b/src/bin/memory-search.rs index 88ab07c..2cfd6dd 100644 --- a/src/bin/memory-search.rs +++ b/src/bin/memory-search.rs @@ -150,12 +150,11 @@ fn load_or_create_cookie(dir: &Path, session_id: &str) -> String { } fn generate_cookie() -> String { - const ALPHA: &[u8] = b"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; - let mut buf = [0u8; 16]; + let mut buf = [0u8; 12]; fs::File::open("/dev/urandom") .and_then(|mut f| io::Read::read_exact(&mut f, &mut buf)) .expect("failed to read urandom"); - buf.iter().map(|b| ALPHA[(*b as usize) % ALPHA.len()] as char).collect() + buf.iter().map(|b| format!("{:02x}", b)).collect() } fn load_seen(dir: &Path, session_id: &str) -> HashSet {