bug: document clearly that the hash function in std/recursion
is not collision-resistant when inputs are of different length
#1141
Labels
bug
Something isn't working
consolidate
strengthen an existing feature
doc-change-required
Indicates an issue or PR that requires doc to be updated
Description
The short-hash defined in
std/recursion
is used as an efficient way to compute the challenges inside the circuit. For compatibility with existing marshalling schemes and field mismatch, we work on the binary decomposition of the inputs (bits in-circuit, bytes natively). However, in this approach if we have inputs of different length, they can represent same element value, e.g.We do not consider this as an issue currently as the hash function is really meant to be use for in-circuit verifier where the lengths are fixed. We need to add a warning in the constructor function to clearly state that the hash function is not collision resistant in case of different input lengths. Better approach would be if we are able to make the hash function internal and not usable outside of gnark std, but we need to consider that short-hash must be passable to PLONK prover.
The text was updated successfully, but these errors were encountered: