LFDT-Lockness / paillier-zk

Zero-knoledge proofs of some paillier cryptosystem properties for use in CGGMP21
Apache License 2.0
1 stars 1 forks source link

`jacobi` should return `Option<isize>` instead of `isize` #34

Open survived opened 1 year ago

survived commented 1 year ago

jacobi validates input arguments, and if they are invalid, it returns 0 in release build, or panics in debug build. We should rather have jacobi that returns None when provided arguments are invalid. It will help to catch unexpected behavior if it happens.

https://github.com/dfns-labs/paillier-zk/blob/5db04c4a6e36b52656c2ccd9bb9b5dc0fbd66289/src/common/sqrt.rs#L63-L72

survived commented 1 year ago

Actually, we may want jacobi to return Result. It would return: