mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-02-14 10:45:47 +00:00
commit
a57dc7f478
94
.github/workflows/rust.yml
vendored
94
.github/workflows/rust.yml
vendored
@ -3,45 +3,60 @@ name: Rust
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
lint:
|
||||||
|
name: Lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: 1.37.0
|
||||||
|
override: true
|
||||||
|
|
||||||
|
# Ensure all code has been formatted with rustfmt
|
||||||
|
- run: rustup component add rustfmt
|
||||||
|
- name: Check formatting
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: fmt
|
||||||
|
args: --all -- --check --color always
|
||||||
|
|
||||||
test:
|
test:
|
||||||
name: Test on ${{ matrix.os }}
|
name: Test on ${{ matrix.os }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest]
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: Check formatting
|
- uses: actions-rs/toolchain@v1
|
||||||
run: cargo fmt --all -- --check
|
with:
|
||||||
- name: Build
|
toolchain: 1.37.0
|
||||||
run: cargo build --verbose --release --all
|
override: true
|
||||||
- name: Run tests
|
- name: cargo fetch
|
||||||
run: cargo test --verbose --release --all
|
uses: actions-rs/cargo@v1
|
||||||
- name: Run slow tests
|
with:
|
||||||
run: cargo test --verbose --release --all -- --ignored
|
command: fetch
|
||||||
|
- name: Build tests
|
||||||
macOS:
|
uses: actions-rs/cargo@v1
|
||||||
name: Test on macOS-latest
|
with:
|
||||||
runs-on: macOS-latest
|
command: build
|
||||||
|
args: --verbose --release --all --tests
|
||||||
steps:
|
- name: Run tests
|
||||||
- name: Install Rust
|
uses: actions-rs/cargo@v1
|
||||||
run: curl https://sh.rustup.rs -sSf | sh -s -- -y
|
with:
|
||||||
- name: Install rustfmt
|
command: test
|
||||||
run: $HOME/.cargo/bin/rustup component add rustfmt
|
args: --verbose --release --all
|
||||||
- uses: actions/checkout@v1
|
- name: Run slow tests
|
||||||
- name: Check formatting
|
uses: actions-rs/cargo@v1
|
||||||
run: $HOME/.cargo/bin/cargo fmt --all -- --check
|
with:
|
||||||
- name: Build
|
command: test
|
||||||
run: $HOME/.cargo/bin/cargo build --verbose --release --all
|
args: --verbose --release --all -- --ignored
|
||||||
- name: Run tests
|
|
||||||
run: $HOME/.cargo/bin/cargo test --verbose --release --all
|
|
||||||
- name: Run slow tests
|
|
||||||
run: $HOME/.cargo/bin/cargo test --verbose --release --all -- --ignored
|
|
||||||
|
|
||||||
doc-links:
|
doc-links:
|
||||||
name: Check intra-doc links
|
name: Nightly lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@ -50,7 +65,22 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
toolchain: nightly
|
toolchain: nightly
|
||||||
override: true
|
override: true
|
||||||
- uses: actions-rs/cargo@v1
|
- name: cargo fetch
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: fetch
|
||||||
|
|
||||||
|
# Ensure intra-documentation links all resolve correctly
|
||||||
|
# Requires #![deny(intra_doc_link_resolution_failure)] in crates.
|
||||||
|
- name: Check intra-doc links
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: doc
|
command: doc
|
||||||
args: --document-private-items
|
args: --all --document-private-items
|
||||||
|
|
||||||
|
# Build benchmarks to prevent bitrot
|
||||||
|
- name: Build benchmarks
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: build
|
||||||
|
args: --verbose --all --benches
|
||||||
|
58
Cargo.lock
generated
58
Cargo.lock
generated
@ -54,19 +54,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bellman"
|
name = "bellman"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"blake2s_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"blake2s_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ff 0.4.0",
|
"ff 0.5.0",
|
||||||
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"group 0.1.0",
|
"group 0.2.0",
|
||||||
"hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pairing 0.14.2",
|
"pairing 0.15.0",
|
||||||
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -251,16 +251,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ff"
|
name = "ff"
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ff_derive 0.3.0",
|
"ff_derive 0.4.0",
|
||||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ff_derive"
|
name = "ff_derive"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"num-bigint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-bigint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -316,9 +316,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "group"
|
name = "group"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ff 0.4.0",
|
"ff 0.5.0",
|
||||||
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -357,19 +357,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "librustzcash"
|
name = "librustzcash"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bellman 0.1.0",
|
"bellman 0.2.0",
|
||||||
"blake2b_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"blake2b_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"blake2s_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"blake2s_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ff 0.4.0",
|
"ff 0.5.0",
|
||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pairing 0.14.2",
|
"pairing 0.15.0",
|
||||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"zcash_primitives 0.0.0",
|
"zcash_primitives 0.1.0",
|
||||||
"zcash_proofs 0.0.0",
|
"zcash_proofs 0.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -435,11 +435,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pairing"
|
name = "pairing"
|
||||||
version = "0.14.2"
|
version = "0.15.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ff 0.4.0",
|
"ff 0.5.0",
|
||||||
"group 0.1.0",
|
"group 0.2.0",
|
||||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -603,31 +603,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zcash_client_backend"
|
name = "zcash_client_backend"
|
||||||
version = "0.0.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bech32 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bech32 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pairing 0.14.2",
|
"pairing 0.15.0",
|
||||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"zcash_primitives 0.0.0",
|
"zcash_primitives 0.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zcash_primitives"
|
name = "zcash_primitives"
|
||||||
version = "0.0.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"aes 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"blake2b_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"blake2b_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"blake2s_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"blake2s_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"crypto_api_chachapoly 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crypto_api_chachapoly 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ff 0.4.0",
|
"ff 0.5.0",
|
||||||
"fpe 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fpe 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pairing 0.14.2",
|
"pairing 0.15.0",
|
||||||
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -636,17 +636,17 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zcash_proofs"
|
name = "zcash_proofs"
|
||||||
version = "0.0.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bellman 0.1.0",
|
"bellman 0.2.0",
|
||||||
"blake2b_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"blake2b_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ff 0.4.0",
|
"ff 0.5.0",
|
||||||
"pairing 0.14.2",
|
"pairing 0.15.0",
|
||||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"zcash_primitives 0.0.0",
|
"zcash_primitives 0.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
|
@ -7,19 +7,19 @@ homepage = "https://github.com/ebfull/bellman"
|
|||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
name = "bellman"
|
name = "bellman"
|
||||||
repository = "https://github.com/ebfull/bellman"
|
repository = "https://github.com/ebfull/bellman"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bit-vec = "0.4.4"
|
bit-vec = "0.4.4"
|
||||||
blake2s_simd = "0.5"
|
blake2s_simd = "0.5"
|
||||||
ff = { path = "../ff" }
|
ff = { version = "0.5.0", path = "../ff" }
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
futures-cpupool = { version = "0.1", optional = true }
|
futures-cpupool = { version = "0.1", optional = true }
|
||||||
group = { path = "../group" }
|
group = { version = "0.2.0", path = "../group" }
|
||||||
num_cpus = { version = "1", optional = true }
|
num_cpus = { version = "1", optional = true }
|
||||||
crossbeam = { version = "0.7", optional = true }
|
crossbeam = { version = "0.7", optional = true }
|
||||||
pairing = { path = "../pairing", optional = true }
|
pairing = { version = "0.15.0", path = "../pairing", optional = true }
|
||||||
rand_core = "0.5"
|
rand_core = "0.5"
|
||||||
byteorder = "1"
|
byteorder = "1"
|
||||||
|
|
||||||
@ -38,3 +38,6 @@ default = ["groth16", "multicore"]
|
|||||||
name = "mimc"
|
name = "mimc"
|
||||||
path = "tests/mimc.rs"
|
path = "tests/mimc.rs"
|
||||||
required-features = ["groth16"]
|
required-features = ["groth16"]
|
||||||
|
|
||||||
|
[badges]
|
||||||
|
maintenance = { status = "actively-developed" }
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ff"
|
name = "ff"
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
authors = ["Sean Bowe <ewillbefull@gmail.com>"]
|
authors = ["Sean Bowe <ewillbefull@gmail.com>"]
|
||||||
description = "Library for building and interfacing with finite fields"
|
description = "Library for building and interfacing with finite fields"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
@ -12,9 +12,12 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
byteorder = "1"
|
byteorder = "1"
|
||||||
ff_derive = { version = "0.3.0", path = "ff_derive", optional = true }
|
ff_derive = { version = "0.4.0", path = "ff_derive", optional = true }
|
||||||
rand_core = "0.5"
|
rand_core = "0.5"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
derive = ["ff_derive"]
|
derive = ["ff_derive"]
|
||||||
|
|
||||||
|
[badges]
|
||||||
|
maintenance = { status = "actively-developed" }
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ff_derive"
|
name = "ff_derive"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
authors = ["Sean Bowe <ewillbefull@gmail.com>"]
|
authors = ["Sean Bowe <ewillbefull@gmail.com>"]
|
||||||
description = "Procedural macro library used to build custom prime field implementations"
|
description = "Procedural macro library used to build custom prime field implementations"
|
||||||
documentation = "https://docs.rs/ff/"
|
documentation = "https://docs.rs/ff/"
|
||||||
@ -19,3 +19,6 @@ num-integer = "0.1"
|
|||||||
proc-macro2 = "1"
|
proc-macro2 = "1"
|
||||||
quote = "1"
|
quote = "1"
|
||||||
syn = "1"
|
syn = "1"
|
||||||
|
|
||||||
|
[badges]
|
||||||
|
maintenance = { status = "passively-maintained" }
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "group"
|
name = "group"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
authors = [
|
authors = [
|
||||||
"Sean Bowe <ewillbefull@gmail.com>",
|
"Sean Bowe <ewillbefull@gmail.com>",
|
||||||
"Jack Grigg <jack@z.cash>",
|
"Jack Grigg <jack@z.cash>",
|
||||||
@ -15,6 +15,9 @@ repository = "https://github.com/ebfull/group"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ff = { path = "../ff" }
|
ff = { version = "0.5.0", path = "../ff" }
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
rand_xorshift = "0.2"
|
rand_xorshift = "0.2"
|
||||||
|
|
||||||
|
[badges]
|
||||||
|
maintenance = { status = "actively-developed" }
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "librustzcash"
|
name = "librustzcash"
|
||||||
version = "0.1.0"
|
description = "Rust FFI used by the zcashd binary. Not an official API."
|
||||||
|
version = "0.2.0"
|
||||||
authors = [
|
authors = [
|
||||||
"Sean Bowe <ewillbefull@gmail.com>",
|
"Sean Bowe <ewillbefull@gmail.com>",
|
||||||
"Jack Grigg <jack@z.cash>",
|
"Jack Grigg <jack@z.cash>",
|
||||||
"Jay Graber <jay@z.cash>",
|
"Jay Graber <jay@z.cash>",
|
||||||
"Simon Liu <simon@z.cash>"
|
"Simon Liu <simon@z.cash>"
|
||||||
]
|
]
|
||||||
|
homepage = "https://github.com/zcash/librustzcash"
|
||||||
|
repository = "https://github.com/zcash/librustzcash"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
@ -16,14 +20,17 @@ path = "src/rustzcash.rs"
|
|||||||
crate-type = ["staticlib"]
|
crate-type = ["staticlib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bellman = { path = "../bellman" }
|
bellman = { version = "0.2.0", path = "../bellman" }
|
||||||
blake2b_simd = "0.5"
|
blake2b_simd = "0.5"
|
||||||
blake2s_simd = "0.5"
|
blake2s_simd = "0.5"
|
||||||
ff = { path = "../ff" }
|
ff = { version = "0.5.0", path = "../ff" }
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
pairing = { path = "../pairing" }
|
pairing = { version = "0.15.0", path = "../pairing" }
|
||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
byteorder = "1"
|
byteorder = "1"
|
||||||
rand_core = "0.5.1"
|
rand_core = "0.5.1"
|
||||||
zcash_primitives = { path = "../zcash_primitives" }
|
zcash_primitives = { version = "0.1.0", path = "../zcash_primitives" }
|
||||||
zcash_proofs = { path = "../zcash_proofs" }
|
zcash_proofs = { version = "0.1.0", path = "../zcash_proofs" }
|
||||||
|
|
||||||
|
[badges]
|
||||||
|
maintenance = { status = "deprecated" }
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "pairing"
|
name = "pairing"
|
||||||
|
|
||||||
# Remember to change version string in README.md.
|
# Remember to change version string in README.md.
|
||||||
version = "0.14.2"
|
version = "0.15.0"
|
||||||
authors = [
|
authors = [
|
||||||
"Sean Bowe <ewillbefull@gmail.com>",
|
"Sean Bowe <ewillbefull@gmail.com>",
|
||||||
"Jack Grigg <jack@z.cash>",
|
"Jack Grigg <jack@z.cash>",
|
||||||
@ -18,8 +18,8 @@ edition ="2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
byteorder = "1"
|
byteorder = "1"
|
||||||
ff = { path = "../ff", features = ["derive"] }
|
ff = { version = "0.5.0", path = "../ff", features = ["derive"] }
|
||||||
group = { path = "../group" }
|
group = { version = "0.2.0", path = "../group" }
|
||||||
rand_core = "0.5"
|
rand_core = "0.5"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
@ -29,3 +29,6 @@ rand_xorshift = "0.2"
|
|||||||
unstable-features = ["expose-arith"]
|
unstable-features = ["expose-arith"]
|
||||||
expose-arith = []
|
expose-arith = []
|
||||||
default = []
|
default = []
|
||||||
|
|
||||||
|
[badges]
|
||||||
|
maintenance = { status = "actively-developed" }
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
mod g1 {
|
mod g1 {
|
||||||
use rand::{Rand, SeedableRng, XorShiftRng};
|
use rand_core::SeedableRng;
|
||||||
|
use rand_xorshift::XorShiftRng;
|
||||||
|
|
||||||
|
use ff::Field;
|
||||||
use group::CurveProjective;
|
use group::CurveProjective;
|
||||||
use pairing::bls12_381::*;
|
use pairing::bls12_381::*;
|
||||||
|
|
||||||
@ -8,10 +10,13 @@ mod g1 {
|
|||||||
fn bench_g1_mul_assign(b: &mut ::test::Bencher) {
|
fn bench_g1_mul_assign(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
|
||||||
|
0xbc, 0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(G1, Fr)> = (0..SAMPLES)
|
let v: Vec<(G1, Fr)> = (0..SAMPLES)
|
||||||
.map(|_| (G1::rand(&mut rng), Fr::rand(&mut rng)))
|
.map(|_| (G1::random(&mut rng), Fr::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -27,10 +32,13 @@ mod g1 {
|
|||||||
fn bench_g1_add_assign(b: &mut ::test::Bencher) {
|
fn bench_g1_add_assign(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
|
||||||
|
0xbc, 0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(G1, G1)> = (0..SAMPLES)
|
let v: Vec<(G1, G1)> = (0..SAMPLES)
|
||||||
.map(|_| (G1::rand(&mut rng), G1::rand(&mut rng)))
|
.map(|_| (G1::random(&mut rng), G1::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -46,10 +54,13 @@ mod g1 {
|
|||||||
fn bench_g1_add_assign_mixed(b: &mut ::test::Bencher) {
|
fn bench_g1_add_assign_mixed(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
|
||||||
|
0xbc, 0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(G1, G1Affine)> = (0..SAMPLES)
|
let v: Vec<(G1, G1Affine)> = (0..SAMPLES)
|
||||||
.map(|_| (G1::rand(&mut rng), G1::rand(&mut rng).into()))
|
.map(|_| (G1::random(&mut rng), G1::random(&mut rng).into()))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -63,8 +74,10 @@ mod g1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mod g2 {
|
mod g2 {
|
||||||
use rand::{Rand, SeedableRng, XorShiftRng};
|
use rand_core::SeedableRng;
|
||||||
|
use rand_xorshift::XorShiftRng;
|
||||||
|
|
||||||
|
use ff::Field;
|
||||||
use group::CurveProjective;
|
use group::CurveProjective;
|
||||||
use pairing::bls12_381::*;
|
use pairing::bls12_381::*;
|
||||||
|
|
||||||
@ -72,10 +85,13 @@ mod g2 {
|
|||||||
fn bench_g2_mul_assign(b: &mut ::test::Bencher) {
|
fn bench_g2_mul_assign(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
|
||||||
|
0xbc, 0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(G2, Fr)> = (0..SAMPLES)
|
let v: Vec<(G2, Fr)> = (0..SAMPLES)
|
||||||
.map(|_| (G2::rand(&mut rng), Fr::rand(&mut rng)))
|
.map(|_| (G2::random(&mut rng), Fr::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -91,10 +107,13 @@ mod g2 {
|
|||||||
fn bench_g2_add_assign(b: &mut ::test::Bencher) {
|
fn bench_g2_add_assign(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
|
||||||
|
0xbc, 0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(G2, G2)> = (0..SAMPLES)
|
let v: Vec<(G2, G2)> = (0..SAMPLES)
|
||||||
.map(|_| (G2::rand(&mut rng), G2::rand(&mut rng)))
|
.map(|_| (G2::random(&mut rng), G2::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -110,10 +129,13 @@ mod g2 {
|
|||||||
fn bench_g2_add_assign_mixed(b: &mut ::test::Bencher) {
|
fn bench_g2_add_assign_mixed(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
|
||||||
|
0xbc, 0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(G2, G2Affine)> = (0..SAMPLES)
|
let v: Vec<(G2, G2Affine)> = (0..SAMPLES)
|
||||||
.map(|_| (G2::rand(&mut rng), G2::rand(&mut rng).into()))
|
.map(|_| (G2::random(&mut rng), G2::random(&mut rng).into()))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use rand::{Rand, SeedableRng, XorShiftRng};
|
use rand_core::SeedableRng;
|
||||||
|
use rand_xorshift::XorShiftRng;
|
||||||
|
|
||||||
use ff::{Field, PrimeField, PrimeFieldRepr, SqrtField};
|
use ff::{Field, PrimeField, PrimeFieldRepr, SqrtField};
|
||||||
use pairing::bls12_381::*;
|
use pairing::bls12_381::*;
|
||||||
@ -7,12 +8,15 @@ use pairing::bls12_381::*;
|
|||||||
fn bench_fq_repr_add_nocarry(b: &mut ::test::Bencher) {
|
fn bench_fq_repr_add_nocarry(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(FqRepr, FqRepr)> = (0..SAMPLES)
|
let v: Vec<(FqRepr, FqRepr)> = (0..SAMPLES)
|
||||||
.map(|_| {
|
.map(|_| {
|
||||||
let mut tmp1 = FqRepr::rand(&mut rng);
|
let mut tmp1 = Fq::random(&mut rng).into_repr();
|
||||||
let mut tmp2 = FqRepr::rand(&mut rng);
|
let mut tmp2 = Fq::random(&mut rng).into_repr();
|
||||||
// Shave a few bits off to avoid overflow.
|
// Shave a few bits off to avoid overflow.
|
||||||
for _ in 0..3 {
|
for _ in 0..3 {
|
||||||
tmp1.div2();
|
tmp1.div2();
|
||||||
@ -35,11 +39,14 @@ fn bench_fq_repr_add_nocarry(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq_repr_sub_noborrow(b: &mut ::test::Bencher) {
|
fn bench_fq_repr_sub_noborrow(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(FqRepr, FqRepr)> = (0..SAMPLES)
|
let v: Vec<(FqRepr, FqRepr)> = (0..SAMPLES)
|
||||||
.map(|_| {
|
.map(|_| {
|
||||||
let tmp1 = FqRepr::rand(&mut rng);
|
let tmp1 = Fq::random(&mut rng).into_repr();
|
||||||
let mut tmp2 = tmp1;
|
let mut tmp2 = tmp1;
|
||||||
// Ensure tmp2 is smaller than tmp1.
|
// Ensure tmp2 is smaller than tmp1.
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
@ -62,9 +69,14 @@ fn bench_fq_repr_sub_noborrow(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq_repr_num_bits(b: &mut ::test::Bencher) {
|
fn bench_fq_repr_num_bits(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<FqRepr> = (0..SAMPLES).map(|_| FqRepr::rand(&mut rng)).collect();
|
let v: Vec<FqRepr> = (0..SAMPLES)
|
||||||
|
.map(|_| Fq::random(&mut rng).into_repr())
|
||||||
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -78,9 +90,14 @@ fn bench_fq_repr_num_bits(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq_repr_mul2(b: &mut ::test::Bencher) {
|
fn bench_fq_repr_mul2(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<FqRepr> = (0..SAMPLES).map(|_| FqRepr::rand(&mut rng)).collect();
|
let v: Vec<FqRepr> = (0..SAMPLES)
|
||||||
|
.map(|_| Fq::random(&mut rng).into_repr())
|
||||||
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -95,9 +112,14 @@ fn bench_fq_repr_mul2(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq_repr_div2(b: &mut ::test::Bencher) {
|
fn bench_fq_repr_div2(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<FqRepr> = (0..SAMPLES).map(|_| FqRepr::rand(&mut rng)).collect();
|
let v: Vec<FqRepr> = (0..SAMPLES)
|
||||||
|
.map(|_| Fq::random(&mut rng).into_repr())
|
||||||
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -112,10 +134,13 @@ fn bench_fq_repr_div2(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq_add_assign(b: &mut ::test::Bencher) {
|
fn bench_fq_add_assign(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(Fq, Fq)> = (0..SAMPLES)
|
let v: Vec<(Fq, Fq)> = (0..SAMPLES)
|
||||||
.map(|_| (Fq::rand(&mut rng), Fq::rand(&mut rng)))
|
.map(|_| (Fq::random(&mut rng), Fq::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -131,10 +156,13 @@ fn bench_fq_add_assign(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq_sub_assign(b: &mut ::test::Bencher) {
|
fn bench_fq_sub_assign(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(Fq, Fq)> = (0..SAMPLES)
|
let v: Vec<(Fq, Fq)> = (0..SAMPLES)
|
||||||
.map(|_| (Fq::rand(&mut rng), Fq::rand(&mut rng)))
|
.map(|_| (Fq::random(&mut rng), Fq::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -150,10 +178,13 @@ fn bench_fq_sub_assign(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq_mul_assign(b: &mut ::test::Bencher) {
|
fn bench_fq_mul_assign(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(Fq, Fq)> = (0..SAMPLES)
|
let v: Vec<(Fq, Fq)> = (0..SAMPLES)
|
||||||
.map(|_| (Fq::rand(&mut rng), Fq::rand(&mut rng)))
|
.map(|_| (Fq::random(&mut rng), Fq::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -169,9 +200,12 @@ fn bench_fq_mul_assign(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq_square(b: &mut ::test::Bencher) {
|
fn bench_fq_square(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<Fq> = (0..SAMPLES).map(|_| Fq::rand(&mut rng)).collect();
|
let v: Vec<Fq> = (0..SAMPLES).map(|_| Fq::random(&mut rng)).collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -186,9 +220,12 @@ fn bench_fq_square(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq_inverse(b: &mut ::test::Bencher) {
|
fn bench_fq_inverse(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<Fq> = (0..SAMPLES).map(|_| Fq::rand(&mut rng)).collect();
|
let v: Vec<Fq> = (0..SAMPLES).map(|_| Fq::random(&mut rng)).collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -201,9 +238,12 @@ fn bench_fq_inverse(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq_negate(b: &mut ::test::Bencher) {
|
fn bench_fq_negate(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<Fq> = (0..SAMPLES).map(|_| Fq::rand(&mut rng)).collect();
|
let v: Vec<Fq> = (0..SAMPLES).map(|_| Fq::random(&mut rng)).collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -218,11 +258,14 @@ fn bench_fq_negate(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq_sqrt(b: &mut ::test::Bencher) {
|
fn bench_fq_sqrt(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<Fq> = (0..SAMPLES)
|
let v: Vec<Fq> = (0..SAMPLES)
|
||||||
.map(|_| {
|
.map(|_| {
|
||||||
let mut tmp = Fq::rand(&mut rng);
|
let mut tmp = Fq::random(&mut rng);
|
||||||
tmp.square();
|
tmp.square();
|
||||||
tmp
|
tmp
|
||||||
})
|
})
|
||||||
@ -239,9 +282,12 @@ fn bench_fq_sqrt(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq_into_repr(b: &mut ::test::Bencher) {
|
fn bench_fq_into_repr(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<Fq> = (0..SAMPLES).map(|_| Fq::rand(&mut rng)).collect();
|
let v: Vec<Fq> = (0..SAMPLES).map(|_| Fq::random(&mut rng)).collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -254,10 +300,13 @@ fn bench_fq_into_repr(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq_from_repr(b: &mut ::test::Bencher) {
|
fn bench_fq_from_repr(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<FqRepr> = (0..SAMPLES)
|
let v: Vec<FqRepr> = (0..SAMPLES)
|
||||||
.map(|_| Fq::rand(&mut rng).into_repr())
|
.map(|_| Fq::random(&mut rng).into_repr())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use rand::{Rand, SeedableRng, XorShiftRng};
|
use rand_core::SeedableRng;
|
||||||
|
use rand_xorshift::XorShiftRng;
|
||||||
|
|
||||||
use ff::Field;
|
use ff::Field;
|
||||||
use pairing::bls12_381::*;
|
use pairing::bls12_381::*;
|
||||||
@ -7,10 +8,13 @@ use pairing::bls12_381::*;
|
|||||||
fn bench_fq12_add_assign(b: &mut ::test::Bencher) {
|
fn bench_fq12_add_assign(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(Fq12, Fq12)> = (0..SAMPLES)
|
let v: Vec<(Fq12, Fq12)> = (0..SAMPLES)
|
||||||
.map(|_| (Fq12::rand(&mut rng), Fq12::rand(&mut rng)))
|
.map(|_| (Fq12::random(&mut rng), Fq12::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -26,10 +30,13 @@ fn bench_fq12_add_assign(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq12_sub_assign(b: &mut ::test::Bencher) {
|
fn bench_fq12_sub_assign(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(Fq12, Fq12)> = (0..SAMPLES)
|
let v: Vec<(Fq12, Fq12)> = (0..SAMPLES)
|
||||||
.map(|_| (Fq12::rand(&mut rng), Fq12::rand(&mut rng)))
|
.map(|_| (Fq12::random(&mut rng), Fq12::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -45,10 +52,13 @@ fn bench_fq12_sub_assign(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq12_mul_assign(b: &mut ::test::Bencher) {
|
fn bench_fq12_mul_assign(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(Fq12, Fq12)> = (0..SAMPLES)
|
let v: Vec<(Fq12, Fq12)> = (0..SAMPLES)
|
||||||
.map(|_| (Fq12::rand(&mut rng), Fq12::rand(&mut rng)))
|
.map(|_| (Fq12::random(&mut rng), Fq12::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -64,9 +74,12 @@ fn bench_fq12_mul_assign(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq12_squaring(b: &mut ::test::Bencher) {
|
fn bench_fq12_squaring(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<Fq12> = (0..SAMPLES).map(|_| Fq12::rand(&mut rng)).collect();
|
let v: Vec<Fq12> = (0..SAMPLES).map(|_| Fq12::random(&mut rng)).collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -81,9 +94,12 @@ fn bench_fq12_squaring(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq12_inverse(b: &mut ::test::Bencher) {
|
fn bench_fq12_inverse(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<Fq12> = (0..SAMPLES).map(|_| Fq12::rand(&mut rng)).collect();
|
let v: Vec<Fq12> = (0..SAMPLES).map(|_| Fq12::random(&mut rng)).collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use rand::{Rand, SeedableRng, XorShiftRng};
|
use rand_core::SeedableRng;
|
||||||
|
use rand_xorshift::XorShiftRng;
|
||||||
|
|
||||||
use ff::{Field, SqrtField};
|
use ff::{Field, SqrtField};
|
||||||
use pairing::bls12_381::*;
|
use pairing::bls12_381::*;
|
||||||
@ -7,10 +8,13 @@ use pairing::bls12_381::*;
|
|||||||
fn bench_fq2_add_assign(b: &mut ::test::Bencher) {
|
fn bench_fq2_add_assign(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(Fq2, Fq2)> = (0..SAMPLES)
|
let v: Vec<(Fq2, Fq2)> = (0..SAMPLES)
|
||||||
.map(|_| (Fq2::rand(&mut rng), Fq2::rand(&mut rng)))
|
.map(|_| (Fq2::random(&mut rng), Fq2::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -26,10 +30,13 @@ fn bench_fq2_add_assign(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq2_sub_assign(b: &mut ::test::Bencher) {
|
fn bench_fq2_sub_assign(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(Fq2, Fq2)> = (0..SAMPLES)
|
let v: Vec<(Fq2, Fq2)> = (0..SAMPLES)
|
||||||
.map(|_| (Fq2::rand(&mut rng), Fq2::rand(&mut rng)))
|
.map(|_| (Fq2::random(&mut rng), Fq2::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -45,10 +52,13 @@ fn bench_fq2_sub_assign(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq2_mul_assign(b: &mut ::test::Bencher) {
|
fn bench_fq2_mul_assign(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(Fq2, Fq2)> = (0..SAMPLES)
|
let v: Vec<(Fq2, Fq2)> = (0..SAMPLES)
|
||||||
.map(|_| (Fq2::rand(&mut rng), Fq2::rand(&mut rng)))
|
.map(|_| (Fq2::random(&mut rng), Fq2::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -64,9 +74,12 @@ fn bench_fq2_mul_assign(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq2_squaring(b: &mut ::test::Bencher) {
|
fn bench_fq2_squaring(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<Fq2> = (0..SAMPLES).map(|_| Fq2::rand(&mut rng)).collect();
|
let v: Vec<Fq2> = (0..SAMPLES).map(|_| Fq2::random(&mut rng)).collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -81,9 +94,12 @@ fn bench_fq2_squaring(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq2_inverse(b: &mut ::test::Bencher) {
|
fn bench_fq2_inverse(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<Fq2> = (0..SAMPLES).map(|_| Fq2::rand(&mut rng)).collect();
|
let v: Vec<Fq2> = (0..SAMPLES).map(|_| Fq2::random(&mut rng)).collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -97,9 +113,12 @@ fn bench_fq2_inverse(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fq2_sqrt(b: &mut ::test::Bencher) {
|
fn bench_fq2_sqrt(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<Fq2> = (0..SAMPLES).map(|_| Fq2::rand(&mut rng)).collect();
|
let v: Vec<Fq2> = (0..SAMPLES).map(|_| Fq2::random(&mut rng)).collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use rand::{Rand, SeedableRng, XorShiftRng};
|
use rand_core::SeedableRng;
|
||||||
|
use rand_xorshift::XorShiftRng;
|
||||||
|
|
||||||
use ff::{Field, PrimeField, PrimeFieldRepr, SqrtField};
|
use ff::{Field, PrimeField, PrimeFieldRepr, SqrtField};
|
||||||
use pairing::bls12_381::*;
|
use pairing::bls12_381::*;
|
||||||
@ -7,12 +8,15 @@ use pairing::bls12_381::*;
|
|||||||
fn bench_fr_repr_add_nocarry(b: &mut ::test::Bencher) {
|
fn bench_fr_repr_add_nocarry(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(FrRepr, FrRepr)> = (0..SAMPLES)
|
let v: Vec<(FrRepr, FrRepr)> = (0..SAMPLES)
|
||||||
.map(|_| {
|
.map(|_| {
|
||||||
let mut tmp1 = FrRepr::rand(&mut rng);
|
let mut tmp1 = Fr::random(&mut rng).into_repr();
|
||||||
let mut tmp2 = FrRepr::rand(&mut rng);
|
let mut tmp2 = Fr::random(&mut rng).into_repr();
|
||||||
// Shave a few bits off to avoid overflow.
|
// Shave a few bits off to avoid overflow.
|
||||||
for _ in 0..3 {
|
for _ in 0..3 {
|
||||||
tmp1.div2();
|
tmp1.div2();
|
||||||
@ -35,11 +39,14 @@ fn bench_fr_repr_add_nocarry(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fr_repr_sub_noborrow(b: &mut ::test::Bencher) {
|
fn bench_fr_repr_sub_noborrow(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(FrRepr, FrRepr)> = (0..SAMPLES)
|
let v: Vec<(FrRepr, FrRepr)> = (0..SAMPLES)
|
||||||
.map(|_| {
|
.map(|_| {
|
||||||
let tmp1 = FrRepr::rand(&mut rng);
|
let tmp1 = Fr::random(&mut rng).into_repr();
|
||||||
let mut tmp2 = tmp1;
|
let mut tmp2 = tmp1;
|
||||||
// Ensure tmp2 is smaller than tmp1.
|
// Ensure tmp2 is smaller than tmp1.
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
@ -62,9 +69,14 @@ fn bench_fr_repr_sub_noborrow(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fr_repr_num_bits(b: &mut ::test::Bencher) {
|
fn bench_fr_repr_num_bits(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<FrRepr> = (0..SAMPLES).map(|_| FrRepr::rand(&mut rng)).collect();
|
let v: Vec<FrRepr> = (0..SAMPLES)
|
||||||
|
.map(|_| Fr::random(&mut rng).into_repr())
|
||||||
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -78,9 +90,14 @@ fn bench_fr_repr_num_bits(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fr_repr_mul2(b: &mut ::test::Bencher) {
|
fn bench_fr_repr_mul2(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<FrRepr> = (0..SAMPLES).map(|_| FrRepr::rand(&mut rng)).collect();
|
let v: Vec<FrRepr> = (0..SAMPLES)
|
||||||
|
.map(|_| Fr::random(&mut rng).into_repr())
|
||||||
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -95,9 +112,14 @@ fn bench_fr_repr_mul2(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fr_repr_div2(b: &mut ::test::Bencher) {
|
fn bench_fr_repr_div2(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<FrRepr> = (0..SAMPLES).map(|_| FrRepr::rand(&mut rng)).collect();
|
let v: Vec<FrRepr> = (0..SAMPLES)
|
||||||
|
.map(|_| Fr::random(&mut rng).into_repr())
|
||||||
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -112,10 +134,13 @@ fn bench_fr_repr_div2(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fr_add_assign(b: &mut ::test::Bencher) {
|
fn bench_fr_add_assign(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(Fr, Fr)> = (0..SAMPLES)
|
let v: Vec<(Fr, Fr)> = (0..SAMPLES)
|
||||||
.map(|_| (Fr::rand(&mut rng), Fr::rand(&mut rng)))
|
.map(|_| (Fr::random(&mut rng), Fr::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -131,10 +156,13 @@ fn bench_fr_add_assign(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fr_sub_assign(b: &mut ::test::Bencher) {
|
fn bench_fr_sub_assign(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(Fr, Fr)> = (0..SAMPLES)
|
let v: Vec<(Fr, Fr)> = (0..SAMPLES)
|
||||||
.map(|_| (Fr::rand(&mut rng), Fr::rand(&mut rng)))
|
.map(|_| (Fr::random(&mut rng), Fr::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -150,10 +178,13 @@ fn bench_fr_sub_assign(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fr_mul_assign(b: &mut ::test::Bencher) {
|
fn bench_fr_mul_assign(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(Fr, Fr)> = (0..SAMPLES)
|
let v: Vec<(Fr, Fr)> = (0..SAMPLES)
|
||||||
.map(|_| (Fr::rand(&mut rng), Fr::rand(&mut rng)))
|
.map(|_| (Fr::random(&mut rng), Fr::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@ -169,9 +200,12 @@ fn bench_fr_mul_assign(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fr_square(b: &mut ::test::Bencher) {
|
fn bench_fr_square(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<Fr> = (0..SAMPLES).map(|_| Fr::rand(&mut rng)).collect();
|
let v: Vec<Fr> = (0..SAMPLES).map(|_| Fr::random(&mut rng)).collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -186,9 +220,12 @@ fn bench_fr_square(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fr_inverse(b: &mut ::test::Bencher) {
|
fn bench_fr_inverse(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<Fr> = (0..SAMPLES).map(|_| Fr::rand(&mut rng)).collect();
|
let v: Vec<Fr> = (0..SAMPLES).map(|_| Fr::random(&mut rng)).collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -201,9 +238,12 @@ fn bench_fr_inverse(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fr_negate(b: &mut ::test::Bencher) {
|
fn bench_fr_negate(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<Fr> = (0..SAMPLES).map(|_| Fr::rand(&mut rng)).collect();
|
let v: Vec<Fr> = (0..SAMPLES).map(|_| Fr::random(&mut rng)).collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -218,11 +258,14 @@ fn bench_fr_negate(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fr_sqrt(b: &mut ::test::Bencher) {
|
fn bench_fr_sqrt(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<Fr> = (0..SAMPLES)
|
let v: Vec<Fr> = (0..SAMPLES)
|
||||||
.map(|_| {
|
.map(|_| {
|
||||||
let mut tmp = Fr::rand(&mut rng);
|
let mut tmp = Fr::random(&mut rng);
|
||||||
tmp.square();
|
tmp.square();
|
||||||
tmp
|
tmp
|
||||||
})
|
})
|
||||||
@ -239,9 +282,12 @@ fn bench_fr_sqrt(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fr_into_repr(b: &mut ::test::Bencher) {
|
fn bench_fr_into_repr(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<Fr> = (0..SAMPLES).map(|_| Fr::rand(&mut rng)).collect();
|
let v: Vec<Fr> = (0..SAMPLES).map(|_| Fr::random(&mut rng)).collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -254,10 +300,13 @@ fn bench_fr_into_repr(b: &mut ::test::Bencher) {
|
|||||||
fn bench_fr_from_repr(b: &mut ::test::Bencher) {
|
fn bench_fr_from_repr(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<FrRepr> = (0..SAMPLES)
|
let v: Vec<FrRepr> = (0..SAMPLES)
|
||||||
.map(|_| Fr::rand(&mut rng).into_repr())
|
.map(|_| Fr::random(&mut rng).into_repr())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
|
@ -4,8 +4,10 @@ mod fq12;
|
|||||||
mod fq2;
|
mod fq2;
|
||||||
mod fr;
|
mod fr;
|
||||||
|
|
||||||
use rand::{Rand, SeedableRng, XorShiftRng};
|
use rand_core::SeedableRng;
|
||||||
|
use rand_xorshift::XorShiftRng;
|
||||||
|
|
||||||
|
use group::CurveProjective;
|
||||||
use pairing::bls12_381::*;
|
use pairing::bls12_381::*;
|
||||||
use pairing::{Engine, PairingCurveAffine};
|
use pairing::{Engine, PairingCurveAffine};
|
||||||
|
|
||||||
@ -13,9 +15,12 @@ use pairing::{Engine, PairingCurveAffine};
|
|||||||
fn bench_pairing_g1_preparation(b: &mut ::test::Bencher) {
|
fn bench_pairing_g1_preparation(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<G1> = (0..SAMPLES).map(|_| G1::rand(&mut rng)).collect();
|
let v: Vec<G1> = (0..SAMPLES).map(|_| G1::random(&mut rng)).collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -29,9 +34,12 @@ fn bench_pairing_g1_preparation(b: &mut ::test::Bencher) {
|
|||||||
fn bench_pairing_g2_preparation(b: &mut ::test::Bencher) {
|
fn bench_pairing_g2_preparation(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<G2> = (0..SAMPLES).map(|_| G2::rand(&mut rng)).collect();
|
let v: Vec<G2> = (0..SAMPLES).map(|_| G2::random(&mut rng)).collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@ -45,13 +53,16 @@ fn bench_pairing_g2_preparation(b: &mut ::test::Bencher) {
|
|||||||
fn bench_pairing_miller_loop(b: &mut ::test::Bencher) {
|
fn bench_pairing_miller_loop(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(G1Prepared, G2Prepared)> = (0..SAMPLES)
|
let v: Vec<(G1Prepared, G2Prepared)> = (0..SAMPLES)
|
||||||
.map(|_| {
|
.map(|_| {
|
||||||
(
|
(
|
||||||
G1Affine::from(G1::rand(&mut rng)).prepare(),
|
G1Affine::from(G1::random(&mut rng)).prepare(),
|
||||||
G2Affine::from(G2::rand(&mut rng)).prepare(),
|
G2Affine::from(G2::random(&mut rng)).prepare(),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
@ -68,13 +79,16 @@ fn bench_pairing_miller_loop(b: &mut ::test::Bencher) {
|
|||||||
fn bench_pairing_final_exponentiation(b: &mut ::test::Bencher) {
|
fn bench_pairing_final_exponentiation(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<Fq12> = (0..SAMPLES)
|
let v: Vec<Fq12> = (0..SAMPLES)
|
||||||
.map(|_| {
|
.map(|_| {
|
||||||
(
|
(
|
||||||
G1Affine::from(G1::rand(&mut rng)).prepare(),
|
G1Affine::from(G1::random(&mut rng)).prepare(),
|
||||||
G2Affine::from(G2::rand(&mut rng)).prepare(),
|
G2Affine::from(G2::random(&mut rng)).prepare(),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.map(|(ref p, ref q)| Bls12::miller_loop(&[(p, q)]))
|
.map(|(ref p, ref q)| Bls12::miller_loop(&[(p, q)]))
|
||||||
@ -92,10 +106,13 @@ fn bench_pairing_final_exponentiation(b: &mut ::test::Bencher) {
|
|||||||
fn bench_pairing_full(b: &mut ::test::Bencher) {
|
fn bench_pairing_full(b: &mut ::test::Bencher) {
|
||||||
const SAMPLES: usize = 1000;
|
const SAMPLES: usize = 1000;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
0xe5,
|
||||||
|
]);
|
||||||
|
|
||||||
let v: Vec<(G1, G2)> = (0..SAMPLES)
|
let v: Vec<(G1, G2)> = (0..SAMPLES)
|
||||||
.map(|_| (G1::rand(&mut rng), G2::rand(&mut rng)))
|
.map(|_| (G1::random(&mut rng), G2::random(&mut rng)))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
extern crate ff;
|
extern crate ff;
|
||||||
extern crate group;
|
extern crate group;
|
||||||
extern crate pairing;
|
extern crate pairing;
|
||||||
extern crate rand;
|
extern crate rand_core;
|
||||||
|
extern crate rand_xorshift;
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
|
||||||
mod bls12_381;
|
mod bls12_381;
|
||||||
|
@ -1,17 +1,24 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "zcash_client_backend"
|
name = "zcash_client_backend"
|
||||||
version = "0.0.0"
|
description = "APIs for creating shielded Zcash light clients"
|
||||||
|
version = "0.1.0"
|
||||||
authors = [
|
authors = [
|
||||||
"Jack Grigg <jack@z.cash>",
|
"Jack Grigg <jack@z.cash>",
|
||||||
]
|
]
|
||||||
|
homepage = "https://github.com/zcash/librustzcash"
|
||||||
|
repository = "https://github.com/zcash/librustzcash"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bech32 = "0.7"
|
bech32 = "0.7"
|
||||||
pairing = { path = "../pairing" }
|
pairing = { version = "0.15.0", path = "../pairing" }
|
||||||
zcash_primitives = { path = "../zcash_primitives" }
|
zcash_primitives = { version = "0.1.0", path = "../zcash_primitives" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rand_core = "0.5"
|
rand_core = "0.5"
|
||||||
rand_xorshift = "0.2"
|
rand_xorshift = "0.2"
|
||||||
|
|
||||||
|
[badges]
|
||||||
|
maintenance = { status = "actively-developed" }
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "zcash_primitives"
|
name = "zcash_primitives"
|
||||||
version = "0.0.0"
|
description = "Rust implementations of the Zcash primitives"
|
||||||
|
version = "0.1.0"
|
||||||
authors = [
|
authors = [
|
||||||
"Jack Grigg <jack@z.cash>",
|
"Jack Grigg <jack@z.cash>",
|
||||||
]
|
]
|
||||||
|
homepage = "https://github.com/zcash/librustzcash"
|
||||||
|
repository = "https://github.com/zcash/librustzcash"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@ -13,12 +17,12 @@ blake2b_simd = "0.5"
|
|||||||
blake2s_simd = "0.5"
|
blake2s_simd = "0.5"
|
||||||
byteorder = "1"
|
byteorder = "1"
|
||||||
crypto_api_chachapoly = "0.2.1"
|
crypto_api_chachapoly = "0.2.1"
|
||||||
ff = { path = "../ff" }
|
ff = { version = "0.5.0", path = "../ff" }
|
||||||
fpe = "0.2"
|
fpe = "0.2"
|
||||||
hex = "0.3"
|
hex = "0.3"
|
||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
pairing = { path = "../pairing" }
|
pairing = { version = "0.15.0", path = "../pairing" }
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
rand_core = "0.5.1"
|
rand_core = "0.5.1"
|
||||||
sha2 = "0.8"
|
sha2 = "0.8"
|
||||||
@ -26,3 +30,6 @@ sha2 = "0.8"
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
hex-literal = "0.2"
|
hex-literal = "0.2"
|
||||||
rand_xorshift = "0.2"
|
rand_xorshift = "0.2"
|
||||||
|
|
||||||
|
[badges]
|
||||||
|
maintenance = { status = "actively-developed" }
|
||||||
|
@ -1,21 +1,25 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "zcash_proofs"
|
name = "zcash_proofs"
|
||||||
version = "0.0.0"
|
description = "Zcash zk-SNARK circuits and proving APIs"
|
||||||
|
version = "0.1.0"
|
||||||
authors = [
|
authors = [
|
||||||
"Jack Grigg <jack@z.cash>",
|
"Jack Grigg <jack@z.cash>",
|
||||||
]
|
]
|
||||||
|
homepage = "https://github.com/zcash/librustzcash"
|
||||||
|
repository = "https://github.com/zcash/librustzcash"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bellman = { path = "../bellman" }
|
bellman = { version = "0.2.0", path = "../bellman" }
|
||||||
blake2b_simd = "0.5"
|
blake2b_simd = "0.5"
|
||||||
byteorder = "1"
|
byteorder = "1"
|
||||||
directories = { version = "1", optional = true }
|
directories = { version = "1", optional = true }
|
||||||
ff = { path = "../ff" }
|
ff = { version = "0.5.0", path = "../ff" }
|
||||||
pairing = { path = "../pairing" }
|
pairing = { version = "0.15.0", path = "../pairing" }
|
||||||
rand_core = "0.5.1"
|
rand_core = "0.5.1"
|
||||||
zcash_primitives = { path = "../zcash_primitives" }
|
zcash_primitives = { version = "0.1.0", path = "../zcash_primitives" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rand_xorshift = "0.2"
|
rand_xorshift = "0.2"
|
||||||
@ -23,3 +27,6 @@ rand_xorshift = "0.2"
|
|||||||
[features]
|
[features]
|
||||||
default = ["local-prover"]
|
default = ["local-prover"]
|
||||||
local-prover = ["directories"]
|
local-prover = ["directories"]
|
||||||
|
|
||||||
|
[badges]
|
||||||
|
maintenance = { status = "actively-developed" }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user