rust-paillier icon indicating copy to clipboard operation
rust-paillier copied to clipboard

Serialization for BigInts is redefined to be in base 10 instead of 16

Open vnermolaev opened this issue 2 years ago • 0 comments

I noticed that the crate redefines serialization of curv::BigInts to be in base 10, e.g.,

for KeyPair, p and q are going to be in base 10

https://github.com/ZenGo-X/rust-paillier/blob/7d4958fb73cdae283906449e71f0dbb10ff459b3/src/lib.rs#L23-L29

because

https://github.com/ZenGo-X/rust-paillier/blob/7d4958fb73cdae283906449e71f0dbb10ff459b3/src/serialize.rs#L9-L11

while in the curv crate BigInts are serialized using base 16

https://github.com/ZenGo-X/curv/blob/78cac40a47e145eb845d687cc748f9312d999db9/src/arithmetic/serde_support.rs#L9-L21

Imagine a server defines a struct as such

#[derive(Serialize, Deserialize)]
struct S {
  b: curv::BigInt,
  ek: EncryptionKey
 } 

then a third-party app needs to selectively serialize BigInts of the corresponding fields.

What was the reason behind that?

vnermolaev avatar Feb 17 '23 15:02 vnermolaev