Crates.io | sha1-macros |
lib.rs | sha1-macros |
version | 1.0.0 |
source | src |
created_at | 2024-04-07 19:39:33.165644 |
updated_at | 2024-04-07 19:39:33.165644 |
description | Macros for computing SHA1 hashes at compile-time |
homepage | |
repository | https://github.com/xoddiel/sha1-macros |
max_upload_size | |
id | 1199466 |
size | 5,090 |
The sha1-macros
crate allows you to compute SHA1 hashes at compile-time.
assert_eq!(sha1_hex!("this is a test"), "fa26be19de6bff93f70bc2308434e4a440bbad02");
assert_eq!(sha1_bytes!("this is a test"), hex!("fa26be19de6bff93f70bc2308434e4a440bbad02"));
const fn
?Simple answer: It is not yet possible to create a &'static str
at compile-time using const fn
. By providing macros,
we remove the need to encode your hash digest into hex or base64 at runtime. Note that this has the limitation that the
input of sha1_*
macros must be either a string ("value"
) or a byte (b"value"
) literal. It cannot be a const
value.