tkaitchuck / constrandom

Macro to generate random constants in Rust https://xkcd.com/221/
Apache License 2.0
73 stars 14 forks source link

feat: Generate constant random byte arrays #23

Closed ironhaven closed 1 year ago

ironhaven commented 2 years ago

The const_random macro will now accept and generate fixed sized u8 arrays of any size. #22

Implementation detail: This patch replaces the 256 bit fixed sized sha3 hash (SHA3-256) with the sha3 eXtendable-Output Function (SHAKE256). This is to allow arbitrarily long byte arrays to be generated. Replacing SHA3-245 is not strictly necessary because the tiny-keccak crate does not limit the output size of sha3 functions, but I feel that misusing crypto primitives is a code smell.