arkworks-rs / crypto-primitives

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

Fix pedersen padding #79

Closed rozbb closed 1 year ago

rozbb commented 2 years ago

Description

This fixes the Pedersen padding bug #76. To do this, I simply pad the input bits rather than bytes, so that the padding length check succeeds. I've also changed the tests slightly so that they're regression tests. I wasn't sure the best way to do it so let me know if you'd rather the parameters be different. To demonstrate the bug, you just need NUM_WINDOWS * WINDOW_SIZE to not be divisible by 8.

closes: #76


Before we can merge this PR, please make sure that all the following items have been checked off. If any of the checklist items are not applicable, please leave them but write a little note why.

rozbb commented 2 years ago

That is already checked in the assert at the top of the function. Should this be in addition or in the place of?

Pratyush commented 2 years ago

Oops, good point.