mratsim / constantine

Constantine: modular, high-performance, zero-dependency cryptography stack for verifiable computation, proof systems and blockchain protocols.
Other
413 stars 44 forks source link

Enhancement of `generateChallengeScalar()` in Verkle Cryptography API #351

Closed agnxsh closed 10 months ago

agnxsh commented 10 months ago

In generateChallengeScalar for Banderwagon Frs, using a transcript state, we earlier did a normal scalar_deserialize which internally validated whether the scalar existed within the scalar field of Banderwagon or not. However, as challenge scalars are often generated from strings represented as byte arrays, there can be often cases where the scalar may overflow in it's natural representation, hence, the idea is to deserialize the scalar directly to it's Montgomery residue form, and generate a challenge scalar from it.

Further, it's a good practice test the algorithm with a few cross-client test cases.