Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually implement serde::Serialize/Deserialize for bigger t values #3

Merged
merged 1 commit into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ rand_core = "0.6.3"
curv-kzen = { git = "https://github.com/ZenGo-X/curv", branch = "ffts" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
criterion = "0.3"
serde_with = "1.11.0"

[dev-dependencies]
quickcheck = "0.9"
quickcheck_macros = "0.9"
criterion = "0.3"


[[bench]]
name = "dpf_bench"
Expand Down
8 changes: 8 additions & 0 deletions src/keygen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,32 @@ use curv::cryptographic_primitives::secret_sharing::{
use curv::elliptic::curves::{Point, Scalar, Secp256k1};
use curv::BigInt;
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
use std::convert::TryInto;
use std::ops::{Add, Neg};
use std::ptr;
use std::{fs, mem};

#[serde_as]
#[derive(Debug, Serialize, Deserialize)]
pub struct LongTermKey {
pub alpha_i: Scalar<Secp256k1>,
pub sk_i: Scalar<Secp256k1>,
#[serde_as(as = "[[_; t]; c]")]
pub w_i: [[BigInt; t]; c],
#[serde_as(as = "[[_; t]; c]")]
pub eta_i: [[BigInt; t]; c],
#[serde_as(as = "[[_; t]; c]")]
pub beta_i: [[Scalar<Secp256k1>; t]; c],
#[serde_as(as = "[[_; t]; c]")]
pub gamma_i: [[Scalar<Secp256k1>; t]; c],
pub u_i_0: [[DSPF; (n - 1)]; c],
pub u_i_1: [[DSPF; (n - 1)]; c],
pub v_i_0: [[DSPF; (n - 1)]; c],
pub v_i_1: [[DSPF; (n - 1)]; c],
#[serde_as(as = "[[_; (n - 1)]; c * c]")]
pub c_i_0: [[DSPF; (n - 1)]; c * c],
#[serde_as(as = "[[_; (n - 1)]; c * c]")]
pub c_i_1: [[DSPF; (n - 1)]; c * c],
pub pk: Point<Secp256k1>,
}
Expand Down