Use u128::from_ne_bytes(buffer).to_string()

base64 crate is small, but I guess we don't benefit from it much either
This commit is contained in:
Tony 2025-12-30 12:50:58 +08:00
parent 4df5a19037
commit bee0175776
No known key found for this signature in database
GPG Key ID: 34BDD3EA27824956

View File

@ -135,7 +135,7 @@ fn replace_csp_nonce(
// > https://w3c.github.io/webappsec-csp/#security-nonces
let mut buffer: [u8; 16] = [0; 16];
getrandom::fill(&mut buffer).expect("failed to get random bytes");
format!("{buffer:x?}")
u128::from_ne_bytes(buffer).to_string()
})
});