arkworks-rs / crypto-primitives

Interfaces and implementations of cryptographic primitives, along with R1CS constraints for them
https://www.arkworks.rs
Apache License 2.0
165 stars 79 forks source link

Inconsistencies in the Blake2s implementation #108

Open ii-cruz opened 1 year ago

ii-cruz commented 1 year ago

On #103 the parameters function was removed from the Blake2sWithParameterBlock. However, for prf::blake2s::constraints::evaluate_blake2s_with_parameters, we need the parameters formatted as [u32; 8] as an argument, which would be exposed by calling the removed function.

Additionally, the non-constraint evaluate function now only runs in Mac mode. Even if no key is provided, a full 0-padded block is prefixed. This is different from the constraint behavior.

paberr commented 1 year ago

Moreover, the change in the Blake2sWithParameterBlock struct removed the possibility to run the Blake2X algorithm for an extensible-output function.

To be fair, it seems that the blake2 crate doesn't support XOFs anymore. The constraint implementation technically still supports it with a custom parameter block.