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
|
pub struct Keypair { |
|
#[serde(with = "crate::serialize::bigint")] |
|
pub p: BigInt, // TODO[Morten] okay to make non-public? |
|
|
|
#[serde(with = "crate::serialize::bigint")] |
|
pub q: BigInt, // TODO[Morten] okay to make non-public? |
|
} |
because
|
pub fn serialize<S: ser::Serializer>(x: &BigInt, serializer: S) -> Result<S::Ok, S::Error> { |
|
serializer.serialize_str(&x.to_str_radix(10)) |
|
} |
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?
I noticed that the crate redefines serialization of
curv::BigInts to be in base 10, e.g.,for
KeyPair,pandqare going to be in base 10rust-paillier/src/lib.rs
Lines 23 to 29 in 7d4958f
because
rust-paillier/src/serialize.rs
Lines 9 to 11 in 7d4958f
while in the
curvcrateBigInts are serialized using base 16https://github.com/ZenGo-X/curv/blob/78cac40a47e145eb845d687cc748f9312d999db9/src/arithmetic/serde_support.rs#L9-L21
Imagine a server defines a struct as such
then a third-party app needs to selectively serialize
BigInts of the corresponding fields.What was the reason behind that?