Skip to content

Commit

Permalink
Revert change to bls12381
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-lj committed Nov 25, 2022
1 parent 76ab74a commit 21934ab
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions fastcrypto/src/bls12381.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,31 @@ use std::{
str::FromStr,
};

use crate::encoding::Encoding;
use ::blst::{blst_scalar, blst_scalar_from_le_bytes, blst_scalar_from_uint64, BLST_ERROR};
use eyre::eyre;

use once_cell::sync::OnceCell;
use zeroize::Zeroize;

use fastcrypto_derive::{SilentDebug, SilentDisplay};

use crate::{
encoding::Base64, error::FastCryptoError, pubkey_bytes::PublicKeyBytes,
serde_helpers::keypair_decode_base64,
};
use eyre::eyre;
use serde::{
de::{self},
Deserialize, Serialize,
};
use serde_with::serde_as;
use signature::{Signature, Signer, Verifier};
use zeroize::Zeroize;

use fastcrypto_derive::{SilentDebug, SilentDisplay};
use signature::{Signature, Signer, Verifier};

use crate::encoding::Encoding;
use crate::traits::{
AggregateAuthenticator, AllowedRng, Authenticator, EncodeDecodeBase64, KeyPair, SigningKey,
ToFromBytes, VerifyingKey,
};
use crate::{
encoding::Base64, error::FastCryptoError, pubkey_bytes::PublicKeyBytes,
serde_helpers::keypair_decode_base64,
};

// BLS signatures use two groups G1, G2, where elements of the first can be encoded using 48 bytes
// and of the second using 96 bytes. BLS supports two modes:
Expand Down Expand Up @@ -773,25 +776,19 @@ pub const BLS_G2_LENGTH: usize = 96;

/// Module minimizing the size of signatures. See also [min_pk].
pub mod min_sig {
use blst::min_sig as blst;

use crate::serde_helpers::min_sig::BlsSignature;

use super::*;

use crate::serde_helpers::min_sig::BlsSignature;
use blst::min_sig as blst;
/// Hash-to-curve domain seperation tag.
pub const DST_G1: &[u8] = b"BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_";
define_bls12381!(BLS_G2_LENGTH, BLS_G1_LENGTH, DST_G1);
}

/// Module minimizing the size of public keys. See also [min_sig].
pub mod min_pk {
use blst::min_pk as blst;

use crate::serde_helpers::min_pk::BlsSignature;

use super::*;

use crate::serde_helpers::min_pk::BlsSignature;
use blst::min_pk as blst;
/// Hash-to-curve domain seperation tag.
pub const DST_G2: &[u8] = b"BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_";
define_bls12381!(BLS_G1_LENGTH, BLS_G2_LENGTH, DST_G2);
Expand All @@ -807,7 +804,6 @@ pub mod min_pk {
blst_scalar_from_fr,
};
use once_cell::sync::OnceCell;

//
// Implement MSKR for BLS12381
//
Expand Down

0 comments on commit 21934ab

Please sign in to comment.