mirror of
https://github.com/arnaucube/babyjubjub-ark.git
synced 2026-01-13 17:21:29 +01:00
v0.0.4
- update poseidon-rs to v0.0.5 - remove TravisCI and add GithubAction for tests - remove mimc-rs support
This commit is contained in:
13
.github/workflows/test.yml
vendored
Normal file
13
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
name: Test
|
||||||
|
on: [push, pull_request]
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Build
|
||||||
|
run: cargo build --verbose
|
||||||
|
- name: Run tests
|
||||||
|
run: cargo test --verbose
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
language: rust
|
|
||||||
rust:
|
|
||||||
- stable
|
|
||||||
|
|
||||||
cache:
|
|
||||||
- cargo
|
|
||||||
|
|
||||||
script:
|
|
||||||
- RUST_BACKTRACE=1 cargo test --all
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "babyjubjub-rs"
|
name = "babyjubjub-rs"
|
||||||
version = "0.0.3"
|
version = "0.0.4"
|
||||||
authors = ["arnaucube <root@arnaucube.com>"]
|
authors = ["arnaucube <root@arnaucube.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
@@ -19,8 +19,7 @@ blake2 = "0.8"
|
|||||||
generic-array = "0.13.2"
|
generic-array = "0.13.2"
|
||||||
tiny-keccak = "1.5"
|
tiny-keccak = "1.5"
|
||||||
rustc-hex = "1.0.0"
|
rustc-hex = "1.0.0"
|
||||||
mimc-rs = "0.0.2"
|
poseidon-rs = "0.0.5"
|
||||||
poseidon-rs = "0.0.4"
|
|
||||||
arrayref = "0.3.5"
|
arrayref = "0.3.5"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
|
|
||||||
|
|||||||
15
README.md
15
README.md
@@ -1,4 +1,5 @@
|
|||||||
# babyjubjub-rs [](https://crates.io/crates/babyjubjub-rs) [](https://travis-ci.org/arnaucube/babyjubjub-rs)
|
# babyjubjub-rs [](https://crates.io/crates/babyjubjub-rs) [](https://github.com/arnaucube/babyjubjub-rs/actions?query=workflow%3ATest)
|
||||||
|
|
||||||
BabyJubJub elliptic curve implementation in Rust. A twisted edwards curve embedded in the curve of BN128/BN256.
|
BabyJubJub elliptic curve implementation in Rust. A twisted edwards curve embedded in the curve of BN128/BN256.
|
||||||
|
|
||||||
BabyJubJub curve explanation: https://medium.com/zokrates/efficient-ecc-in-zksnarks-using-zokrates-bd9ae37b8186
|
BabyJubJub curve explanation: https://medium.com/zokrates/efficient-ecc-in-zksnarks-using-zokrates-bd9ae37b8186
|
||||||
@@ -11,17 +12,7 @@ Compatible with the BabyJubJub implementations in:
|
|||||||
- circom & javascript, from https://github.com/iden3/circomlib
|
- circom & javascript, from https://github.com/iden3/circomlib
|
||||||
|
|
||||||
## Warning
|
## Warning
|
||||||
Doing this in my free time to get familiar with Rust, **do not use in production**.
|
Doing this in my free time, **do not use in production**.
|
||||||
|
|
||||||
- [x] point addition
|
|
||||||
- [x] point scalar multiplication
|
|
||||||
- [x] eddsa keys generation
|
|
||||||
- [x] eddsa signature
|
|
||||||
- [x] eddsa signature verification
|
|
||||||
- [x] {point, pk, signature} compress&decompress parsers
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### References
|
### References
|
||||||
- BabyJubJub curve explanation: https://medium.com/zokrates/efficient-ecc-in-zksnarks-using-zokrates-bd9ae37b8186
|
- BabyJubJub curve explanation: https://medium.com/zokrates/efficient-ecc-in-zksnarks-using-zokrates-bd9ae37b8186
|
||||||
|
|||||||
22
src/lib.rs
22
src/lib.rs
@@ -11,7 +11,6 @@ pub type Fr = poseidon_rs::Fr; // alias
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate arrayref;
|
extern crate arrayref;
|
||||||
extern crate generic_array;
|
extern crate generic_array;
|
||||||
extern crate mimc_rs;
|
|
||||||
extern crate num;
|
extern crate num;
|
||||||
extern crate num_bigint;
|
extern crate num_bigint;
|
||||||
extern crate num_traits;
|
extern crate num_traits;
|
||||||
@@ -20,7 +19,6 @@ extern crate rand6;
|
|||||||
use rand6::Rng;
|
use rand6::Rng;
|
||||||
|
|
||||||
use blake2::{Blake2b, Digest};
|
use blake2::{Blake2b, Digest};
|
||||||
use mimc_rs::Mimc7;
|
|
||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
|
|
||||||
use num_bigint::{BigInt, RandBigInt, RandomBits, Sign, ToBigInt};
|
use num_bigint::{BigInt, RandBigInt, RandomBits, Sign, ToBigInt};
|
||||||
@@ -554,26 +552,6 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[test]
|
|
||||||
// fn test_new_key_sign_verify_mimc_0() {
|
|
||||||
// let sk = new_key();
|
|
||||||
// let pk = sk.public().unwrap();
|
|
||||||
// let msg = 5.to_bigint().unwrap();
|
|
||||||
// let sig = sk.sign_mimc(msg.clone()).unwrap();
|
|
||||||
// let v = verify_mimc(pk, sig, msg);
|
|
||||||
// assert_eq!(v, true);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// #[test]
|
|
||||||
// fn test_new_key_sign_verify_mimc_1() {
|
|
||||||
// let sk = new_key();
|
|
||||||
// let pk = sk.public().unwrap();
|
|
||||||
// let msg = BigInt::parse_bytes(b"123456789012345678901234567890", 10).unwrap();
|
|
||||||
// let sig = sk.sign_mimc(msg.clone()).unwrap();
|
|
||||||
// let v = verify_mimc(pk, sig, msg);
|
|
||||||
// assert_eq!(v, true);
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_new_key_sign_verify_0() {
|
fn test_new_key_sign_verify_0() {
|
||||||
let sk = new_key();
|
let sk = new_key();
|
||||||
|
|||||||
Reference in New Issue
Block a user