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

Add VDF #623

Merged
merged 72 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
2ef299e
Vdf based on classgroup crate and some of class group impl
jonas-lj Jul 26, 2023
9e61aee
Add class group impl
jonas-lj Jul 26, 2023
a281162
chiavdf's verify correctly
jonas-lj Aug 2, 2023
f42a5c7
Align with previous commit
jonas-lj Aug 2, 2023
e8f757e
Clean up code
jonas-lj Aug 2, 2023
7d6c044
Clean up
jonas-lj Aug 2, 2023
4ab79b6
Put class group impl in new file
jonas-lj Aug 2, 2023
4820149
Add prover
jonas-lj Aug 3, 2023
d4682a0
Refactor: use non-compressed forms in public interface
jonas-lj Aug 3, 2023
ae7a64e
Add constructor like method
jonas-lj Aug 3, 2023
8c38505
Update tests and simplify docs
jonas-lj Aug 3, 2023
09ed8b0
Clean up
jonas-lj Aug 3, 2023
b729cf1
Clippy
jonas-lj Aug 3, 2023
65f043c
Clean up
jonas-lj Aug 4, 2023
6e00b46
Add experimental flag
jonas-lj Aug 4, 2023
f5ccf07
Try to fix workflow
jonas-lj Aug 4, 2023
1acd415
Try again
jonas-lj Aug 4, 2023
ddbcbd1
Revert "Try again"
jonas-lj Aug 4, 2023
58ea9d6
Revert changes
jonas-lj Aug 4, 2023
af0c993
Refactor binaryqf impl
jonas-lj Aug 4, 2023
e95db77
Make private
jonas-lj Aug 4, 2023
9b8a942
Fix comment
jonas-lj Aug 4, 2023
80e20f5
Remove redundant mul impl
jonas-lj Aug 4, 2023
703463b
Clean up
jonas-lj Aug 4, 2023
708672d
Refactor parameterized group
jonas-lj Aug 5, 2023
0931ea0
Verify group membership + add vdf from challenge/seed
jonas-lj Aug 7, 2023
a2de898
Make type for discriminant
jonas-lj Aug 7, 2023
acf793f
Align interface with Boneh (2018)
jonas-lj Aug 7, 2023
641e143
Fix vdf abstraction
jonas-lj Aug 7, 2023
e40431a
Fix doc
jonas-lj Aug 7, 2023
20e1bc7
Add module doc
jonas-lj Aug 7, 2023
2f9d824
Align names
jonas-lj Aug 7, 2023
185eba5
Fix const names
jonas-lj Aug 7, 2023
a1fb0f2
Doc
jonas-lj Aug 7, 2023
7101831
Refactor
jonas-lj Aug 7, 2023
a47244d
Clean up imports
jonas-lj Aug 7, 2023
9fe96da
Fix doc
jonas-lj Aug 7, 2023
2f433e1
fmt
jonas-lj Aug 7, 2023
9db26bb
Define difficulty/iterations in the actual vdf construction
jonas-lj Aug 7, 2023
c51300a
doc
jonas-lj Aug 7, 2023
1a95252
doc
jonas-lj Aug 7, 2023
16a343f
doc
jonas-lj Aug 7, 2023
42aada4
Rename module
jonas-lj Aug 7, 2023
fdc0b2e
doc
jonas-lj Aug 7, 2023
2e27341
Align name
jonas-lj Aug 7, 2023
8bcee33
Clean up xgcd impl
jonas-lj Aug 7, 2023
983228b
Align notation with paper
jonas-lj Aug 8, 2023
6268533
Implement doubling function
jonas-lj Aug 9, 2023
d7fd168
Add quadratic form composition algorithm
jonas-lj Aug 9, 2023
b33345d
lower case variables
jonas-lj Aug 9, 2023
9700f02
More tests
jonas-lj Aug 9, 2023
addfc3b
Refactor
jonas-lj Aug 9, 2023
dc5a9ac
Get rid of class_group dep
jonas-lj Aug 10, 2023
a4273b5
Clippy
jonas-lj Aug 10, 2023
149682b
Clean up
jonas-lj Aug 11, 2023
2bd3840
Add test
jonas-lj Aug 11, 2023
e18b9c3
Add tests
jonas-lj Aug 11, 2023
0d4a05f
Use predicate for group parameter test instead
jonas-lj Aug 11, 2023
b491888
Swap inputs
jonas-lj Aug 14, 2023
7c743ca
Add benchmarks and clean up
jonas-lj Aug 15, 2023
244d02a
Move partial euclidean algorithm into compose method
jonas-lj Aug 15, 2023
83affb8
Align partial_xgcd impl with paper
jonas-lj Aug 15, 2023
56c9e39
Clippy
jonas-lj Aug 15, 2023
570a7ed
Add reference
jonas-lj Aug 15, 2023
c25d5d8
Make multiplication algorithm iterative
jonas-lj Aug 15, 2023
14f8cad
Better naming
jonas-lj Aug 16, 2023
0c3eff0
Fix test!
jonas-lj Aug 17, 2023
503c683
Use num-bigint
jonas-lj Aug 17, 2023
c6258d7
Avoid abbreviation
jonas-lj Aug 17, 2023
a7d692d
Try to fix Cargo.lock
jonas-lj Aug 17, 2023
b7ddb82
Add negative test
jonas-lj Aug 17, 2023
daae3bb
Review comments + todos for optimisation
jonas-lj Aug 21, 2023
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
83 changes: 81 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion fastcrypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ ark-ec = "0.4.1"
ark-ff = "0.4.1"
ark-serialize = "0.4.1"
lazy_static = "1.4.0"

num-bigint = "0.4.3"
num-traits = "0.2.16"
num-integer = "0.1.45"
num-prime = { version = "0.4.3", features = ["big-int"] }
fastcrypto-derive = { path = "../fastcrypto-derive", version = "0.1.3" }

[[bench]]
Expand Down
25 changes: 24 additions & 1 deletion fastcrypto/benches/groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ mod group_benches {
use criterion::measurement::Measurement;
use criterion::{measurement, BenchmarkGroup, Criterion};
use fastcrypto::groups::bls12381::{G1Element, G2Element, GTElement};
use fastcrypto::groups::class_group::{Discriminant, QuadraticForm};
use fastcrypto::groups::multiplier::windowed::WindowedScalarMultiplier;
use fastcrypto::groups::multiplier::ScalarMultiplier;
use fastcrypto::groups::ristretto255::RistrettoPoint;
use fastcrypto::groups::secp256r1::ProjectivePoint;
use fastcrypto::groups::{secp256r1, GroupElement, HashToGroupElement, Pairing, Scalar};
use fastcrypto::groups::{
secp256r1, GroupElement, HashToGroupElement, Pairing, ParameterizedGroupElement, Scalar,
};
use num_bigint::BigInt;
use num_traits::Num;
use rand::thread_rng;

fn add_single<G: GroupElement, M: measurement::Measurement>(
Expand Down Expand Up @@ -181,6 +186,23 @@ mod group_benches {
}
}

fn class_group_ops(c: &mut Criterion) {
let mut group: BenchmarkGroup<_> = c.benchmark_group("Class Group Operation");
let d = Discriminant::try_from(BigInt::from_str_radix("-9458193260787340859710210783898414376413627187338129653105774703043377776905956484932486183722303201135571583745806165441941755833466966188398807387661571", 10).unwrap()).unwrap();
let x = QuadraticForm::generator(&d).mul(&BigInt::from(1234));
let y = QuadraticForm::generator(&d).mul(&BigInt::from(4321));
group.bench_function("Compose (512 bit discriminant)", move |b| {
b.iter(|| x.compose(&y))
});

let d = Discriminant::try_from(BigInt::from_str_radix("-173197108158285529655099692042166386683260486655764503111574151459397279244340625070436917386670107433539464870917173822190635872887684166173874718269704667936351650895772937202272326332043347073303124000059154982400685660701006453457007094026343973435157790533480400962985543272080923974737725172126369794019", 10).unwrap()).unwrap();
let x = QuadraticForm::generator(&d).mul(&BigInt::from(1234));
let y = QuadraticForm::generator(&d).mul(&BigInt::from(4321));
group.bench_function("Compose (1024 bit discriminant)", move |b| {
b.iter(|| x.compose(&y))
});
}

criterion_group! {
name = group_benches;
config = Criterion::default().sample_size(100);
Expand All @@ -190,6 +212,7 @@ mod group_benches {
hash_to_group,
pairing,
double_scale,
class_group_ops,
}
}

Expand Down
Loading