Browse Source

v0.0.4

- update poseidon-rs to v0.0.5
- remove TravisCI and add GithubAction for tests
- remove mimc-rs support
main
arnaucube 4 years ago
parent
commit
53f7fd1215
5 changed files with 18 additions and 46 deletions
  1. +13
    -0
      .github/workflows/test.yml
  2. +0
    -9
      .travis.yml
  3. +2
    -3
      Cargo.toml
  4. +3
    -12
      README.md
  5. +0
    -22
      src/lib.rs

+ 13
- 0
.github/workflows/test.yml

@ -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

+ 0
- 9
.travis.yml

@ -1,9 +0,0 @@
language: rust
rust:
- stable
cache:
- cargo
script:
- RUST_BACKTRACE=1 cargo test --all

+ 2
- 3
Cargo.toml

@ -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.4"
poseidon-rs = "0.0.5"
arrayref = "0.3.5" arrayref = "0.3.5"
lazy_static = "1.4.0" lazy_static = "1.4.0"

+ 3
- 12
README.md

@ -1,4 +1,5 @@
# babyjubjub-rs [![Crates.io](https://img.shields.io/crates/v/babyjubjub-rs.svg)](https://crates.io/crates/babyjubjub-rs) [![Build Status](https://travis-ci.org/arnaucube/babyjubjub-rs.svg?branch=master)](https://travis-ci.org/arnaucube/babyjubjub-rs)
# babyjubjub-rs [![Crates.io](https://img.shields.io/crates/v/babyjubjub-rs.svg)](https://crates.io/crates/babyjubjub-rs) [![Test](https://github.com/arnaucube/babyjubjub-rs/workflows/Test/badge.svg)](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**.
- [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
Doing this in my free time, **do not use in production**.
### 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

+ 0
- 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();

Loading…
Cancel
Save