Skip to content

Commit

Permalink
rename to ec-pairing
Browse files Browse the repository at this point in the history
  • Loading branch information
ashWhiteHat committed Jul 27, 2023
1 parent a67020e commit 21b04eb
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 145 deletions.
175 changes: 59 additions & 116 deletions Cargo.lock

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

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ authors = [
'ashWhiteHat<phantomofrotten@gmail.com>',
'KiriosK<KiriosK@yandex.ru>'
]
name = "zero-pairing"
description = 'tate pairing implementation'
version = "0.1.11"
name = "ec-pairing"
description = 'lifted elgamal encryption implementation'
version = "0.0.10"
edition = "2021"
license = "Apache-2.0"
homepage = 'https://github.com/zero-network/zero/'
repository = 'https://github.com/zero-network/zero/'
homepage = 'https://github.com/KogarashiNetwork/Kogarashi/'
repository = 'https://github.com/KogarashiNetwork/Kogarashi/'
readme = 'README.md'

[dependencies]
zero-crypto = { version = "0.1.11", default-features = false }
zero-bls12-381 = { version = "0.1.11", default-features = false }
zero-jubjub = { version = "0.1.11", default-features = false }
parity-scale-codec = { version = "2.1.0", default-features = false, features = ["derive"] }
zkstd = { version = "0.0.10", default-features = false }
bls-12-381 = { version = "0.0.10", default-features = false }
jub-jub = { version = "0.0.10", default-features = false }
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] }

[dev-dependencies]
rand_core = { version="0.6.4", features = ["getrandom"] }
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Tate Pairing
[![CI](https://github.com/KogarashiNetwork/pairing/actions/workflows/ci.yml/badge.svg)](https://github.com/KogarashiNetwork/pairing/actions/workflows/ci.yml) [![crates.io badge](https://img.shields.io/crates/v/zero-pairing.svg)](https://crates.io/crates/zero-pairing) [![GitHub license](https://img.shields.io/badge/license-GPL3%2FApache2-blue)](#LICENSE) [![codecov](https://codecov.io/gh/KogarashiNetwork/pairing/branch/master/graph/badge.svg?token=RA1AA9EGYK)](https://codecov.io/gh/KogarashiNetwork/pairing) [![dependency status](https://deps.rs/crate/zero-pairing/0.1.11/status.svg)](https://deps.rs/crate/zero-pairing/0.1.11)
# Tate Pairing
[![CI](https://github.com/KogarashiNetwork/pairing/actions/workflows/ci.yml/badge.svg)](https://github.com/KogarashiNetwork/pairing/actions/workflows/ci.yml) [![crates.io badge](https://img.shields.io/crates/v/ec-pairing.svg)](https://crates.io/crates/ec-pairing) [![Documentation](https://docs.rs/ec-pairing/badge.svg)](https://docs.rs/ec-pairing) [![GitHub license](https://img.shields.io/badge/license-GPL3%2FApache2-blue)](#LICENSE) [![codecov](https://codecov.io/gh/KogarashiNetwork/pairing/branch/master/graph/badge.svg?token=RA1AA9EGYK)](https://codecov.io/gh/KogarashiNetwork/pairing) [![dependency status](https://deps.rs/crate/ec-pairing/latest/status.svg)](https://deps.rs/crate/ec-pairing/latest)

**This crate uses [https://github.com/zkcrypto/bls12_381](https://github.com/zkcrypto/bls12_381) algorithm designed by @str4d and @ebfull.**
We replace field and curve implementation with `zero-crypto` to make this compatible with `Substrate`.
This crate provides pairing arithmetic and also supports fully `no_std` and [`parity-scale-codec`](https://github.com/paritytech/parity-scale-codec).

## Test

```shell
$ cargo test
```
17 changes: 8 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]

use zero_bls12_381::params::{BLS_X, BLS_X_IS_NEGATIVE};
use zero_bls12_381::{
Fq12, Fr, G1Affine, G1Projective, G2Affine, G2PairingAffine, G2Projective, Gt,
};
use zero_crypto::common::*;
use zero_crypto::common::{G2Pairing, Group, Pairing, PairingRange, PrimeField, Ring, Vec};
use zero_jubjub::{Fp, JubjubAffine, JubjubExtended};
#![no_std]
#![doc = include_str!("../README.md")]

use bls_12_381::params::{BLS_X, BLS_X_IS_NEGATIVE};
use bls_12_381::{Fq12, Fr, G1Affine, G1Projective, G2Affine, G2PairingAffine, G2Projective, Gt};
use jub_jub::{Fp, JubjubAffine, JubjubExtended};
use zkstd::common::*;
use zkstd::common::{G2Pairing, Group, Pairing, PairingRange, PrimeField, Ring, Vec};

// tate pairing with miller algorithm
#[derive(Debug, Clone, Eq, PartialEq, Default, Encode, Decode)]
Expand Down
8 changes: 4 additions & 4 deletions tests/multi_scalar_multiplication.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use bls_12_381::{Fr, G1Affine, G1Projective};
use ec_pairing::{msm_variable_base, TatePairing};
use rand_core::OsRng;
use zero_bls12_381::{Fr, G1Affine, G1Projective};
use zero_crypto::behave::{Group, Projective};
use zero_crypto::common::{Affine, CurveGroup};
use zero_pairing::{msm_variable_base, TatePairing};
use zkstd::behave::{Group, Projective};
use zkstd::common::{Affine, CurveGroup};

fn customized_scalar_point<P: Projective<Extended = P>>(point: P, scalar: &Fr) -> P {
let mut res = P::ADDITIVE_IDENTITY;
Expand Down
6 changes: 3 additions & 3 deletions tests/pairing.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use bls_12_381::{Fq12, Fr, G1Affine, G2Affine, G2PairingAffine, Gt};
use ec_pairing::TatePairing;
use rand_core::OsRng;
use zero_bls12_381::{Fq12, Fr, G1Affine, G2Affine, G2PairingAffine, Gt};
use zero_crypto::{
use zkstd::{
behave::{Group, Pairing, PairingRange},
common::CurveGroup,
};
use zero_pairing::TatePairing;

#[test]
fn generator_pairing_test() {
Expand Down

0 comments on commit 21b04eb

Please sign in to comment.