Open Fumuran opened 2 months ago
I wonder if we can provide the digest without quotation marks - e.g.:
digest!(0x886761b8acc91e06510bfd6a168213c4930c6cf09965427ea22518d3f2e2c01a)
But either way should be fine.
I had created this previously for pathfinder with two macros for const evaluation of hex string and from bytes.
The macros are here, and the const hex parsing here.
We did try existing crates for the hex parsing but they all expect exact lengths which kind of sucks for creating quick test values i.e. they reject 0x123
.
Its also not possible to do this without the quotes unfortunately, as numeric input must fit into a numeric type so you'd be restricted to u128
length. Which might be fine for tests I guess.
Feature description
Create a macro which will be able to create a new
Digest
value from a long hex string in a constant environment (inside a constant function/creation of a constant value). Something like:Why is this feature needed?
This macro will be used during the creation of the constant array of the kernel procedure hashes, making the code more concise.