cardano-crypto-class-2.2.3.0: Type classes abstracting over cryptography primitives for Cardano
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Crypto.EllipticCurve.BLS12_381

Synopsis

Types

data Point curve Source #

A point on an elliptic curve. This type guarantees that the point is part of the | prime order subgroup.

Instances

Instances details
BLS curve ⇒ Eq (Point curve) Source # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Methods

(==)Point curve → Point curve → Bool #

(/=)Point curve → Point curve → Bool #

data PT Source #

Target element without the final exponantiation. By defining target elements | as such, we save up the final exponantiation when computing a pairing, and only | compute it when necessary (e.g. comparison with another point or serialisation)

Instances

Instances details
Eq PT Source # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Methods

(==)PTPTBool #

(/=)PTPTBool #

data Curve1 Source #

Instances

Instances details
BLS Curve1 Source # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Methods

c_blst_on_curvePointPtr Curve1IO Bool Source #

c_blst_add_or_doublePointPtr Curve1PointPtr Curve1PointPtr Curve1IO () Source #

c_blst_multPointPtr Curve1PointPtr Curve1ScalarPtrCSizeIO () Source #

c_blst_cnegPointPtr Curve1BoolIO () Source #

c_blst_scratch_sizeof ∷ Proxy Curve1CSizeCSize Source #

c_blst_to_affinesAffineBlockPtr Curve1PointArrayPtr Curve1CSizeIO () Source #

c_blst_mult_pippengerPointPtr Curve1AffineArrayPtr Curve1CSize → ScalarArrayPtr → CSize → ScratchPtr → IO () Source #

c_blst_hashPointPtr Curve1Ptr CCharCSizePtr CCharCSizePtr CCharCSizeIO () Source #

c_blst_compressPtr CCharPointPtr Curve1IO () Source #

c_blst_serializePtr CCharPointPtr Curve1IO () Source #

c_blst_uncompressAffinePtr Curve1Ptr CCharIO CInt Source #

c_blst_deserializeAffinePtr Curve1Ptr CCharIO CInt Source #

c_blst_in_gPointPtr Curve1IO Bool Source #

c_blst_to_affineAffinePtr Curve1PointPtr Curve1IO () Source #

c_blst_from_affinePointPtr Curve1AffinePtr Curve1IO () Source #

c_blst_affine_in_gAffinePtr Curve1IO Bool Source #

c_blst_generatorPointPtr Curve1 Source #

c_blst_p_is_equalPointPtr Curve1PointPtr Curve1IO Bool Source #

c_blst_p_is_infPointPtr Curve1IO Bool Source #

sizePoint_ ∷ Proxy Curve1CSize

serializedSizePoint_ ∷ Proxy Curve1CSize

compressedSizePoint_ ∷ Proxy Curve1CSize

sizeAffine_ ∷ Proxy Curve1CSize

data Curve2 Source #

Instances

Instances details
BLS Curve2 Source # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Methods

c_blst_on_curvePointPtr Curve2IO Bool Source #

c_blst_add_or_doublePointPtr Curve2PointPtr Curve2PointPtr Curve2IO () Source #

c_blst_multPointPtr Curve2PointPtr Curve2ScalarPtrCSizeIO () Source #

c_blst_cnegPointPtr Curve2BoolIO () Source #

c_blst_scratch_sizeof ∷ Proxy Curve2CSizeCSize Source #

c_blst_to_affinesAffineBlockPtr Curve2PointArrayPtr Curve2CSizeIO () Source #

c_blst_mult_pippengerPointPtr Curve2AffineArrayPtr Curve2CSize → ScalarArrayPtr → CSize → ScratchPtr → IO () Source #

c_blst_hashPointPtr Curve2Ptr CCharCSizePtr CCharCSizePtr CCharCSizeIO () Source #

c_blst_compressPtr CCharPointPtr Curve2IO () Source #

c_blst_serializePtr CCharPointPtr Curve2IO () Source #

c_blst_uncompressAffinePtr Curve2Ptr CCharIO CInt Source #

c_blst_deserializeAffinePtr Curve2Ptr CCharIO CInt Source #

c_blst_in_gPointPtr Curve2IO Bool Source #

c_blst_to_affineAffinePtr Curve2PointPtr Curve2IO () Source #

c_blst_from_affinePointPtr Curve2AffinePtr Curve2IO () Source #

c_blst_affine_in_gAffinePtr Curve2IO Bool Source #

c_blst_generatorPointPtr Curve2 Source #

c_blst_p_is_equalPointPtr Curve2PointPtr Curve2IO Bool Source #

c_blst_p_is_infPointPtr Curve2IO Bool Source #

sizePoint_ ∷ Proxy Curve2CSize

serializedSizePoint_ ∷ Proxy Curve2CSize

compressedSizePoint_ ∷ Proxy Curve2CSize

sizeAffine_ ∷ Proxy Curve2CSize

data BLSTError Source #

BLS Class

class BLS curve Source #

BLS curve operations. Class methods are low-level; user code will want to use higher-level wrappers such as blsAddOrDouble, blsMult, blsCneg, blsNeg, etc.

Instances

Instances details
BLS Curve1 Source # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Methods

c_blst_on_curvePointPtr Curve1IO Bool Source #

c_blst_add_or_doublePointPtr Curve1PointPtr Curve1PointPtr Curve1IO () Source #

c_blst_multPointPtr Curve1PointPtr Curve1ScalarPtrCSizeIO () Source #

c_blst_cnegPointPtr Curve1BoolIO () Source #

c_blst_scratch_sizeof ∷ Proxy Curve1CSizeCSize Source #

c_blst_to_affinesAffineBlockPtr Curve1PointArrayPtr Curve1CSizeIO () Source #

c_blst_mult_pippengerPointPtr Curve1AffineArrayPtr Curve1CSize → ScalarArrayPtr → CSize → ScratchPtr → IO () Source #

c_blst_hashPointPtr Curve1Ptr CCharCSizePtr CCharCSizePtr CCharCSizeIO () Source #

c_blst_compressPtr CCharPointPtr Curve1IO () Source #

c_blst_serializePtr CCharPointPtr Curve1IO () Source #

c_blst_uncompressAffinePtr Curve1Ptr CCharIO CInt Source #

c_blst_deserializeAffinePtr Curve1Ptr CCharIO CInt Source #

c_blst_in_gPointPtr Curve1IO Bool Source #

c_blst_to_affineAffinePtr Curve1PointPtr Curve1IO () Source #

c_blst_from_affinePointPtr Curve1AffinePtr Curve1IO () Source #

c_blst_affine_in_gAffinePtr Curve1IO Bool Source #

c_blst_generatorPointPtr Curve1 Source #

c_blst_p_is_equalPointPtr Curve1PointPtr Curve1IO Bool Source #

c_blst_p_is_infPointPtr Curve1IO Bool Source #

sizePoint_ ∷ Proxy Curve1CSize

serializedSizePoint_ ∷ Proxy Curve1CSize

compressedSizePoint_ ∷ Proxy Curve1CSize

sizeAffine_ ∷ Proxy Curve1CSize

BLS Curve2 Source # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Methods

c_blst_on_curvePointPtr Curve2IO Bool Source #

c_blst_add_or_doublePointPtr Curve2PointPtr Curve2PointPtr Curve2IO () Source #

c_blst_multPointPtr Curve2PointPtr Curve2ScalarPtrCSizeIO () Source #

c_blst_cnegPointPtr Curve2BoolIO () Source #

c_blst_scratch_sizeof ∷ Proxy Curve2CSizeCSize Source #

c_blst_to_affinesAffineBlockPtr Curve2PointArrayPtr Curve2CSizeIO () Source #

c_blst_mult_pippengerPointPtr Curve2AffineArrayPtr Curve2CSize → ScalarArrayPtr → CSize → ScratchPtr → IO () Source #

c_blst_hashPointPtr Curve2Ptr CCharCSizePtr CCharCSizePtr CCharCSizeIO () Source #

c_blst_compressPtr CCharPointPtr Curve2IO () Source #

c_blst_serializePtr CCharPointPtr Curve2IO () Source #

c_blst_uncompressAffinePtr Curve2Ptr CCharIO CInt Source #

c_blst_deserializeAffinePtr Curve2Ptr CCharIO CInt Source #

c_blst_in_gPointPtr Curve2IO Bool Source #

c_blst_to_affineAffinePtr Curve2PointPtr Curve2IO () Source #

c_blst_from_affinePointPtr Curve2AffinePtr Curve2IO () Source #

c_blst_affine_in_gAffinePtr Curve2IO Bool Source #

c_blst_generatorPointPtr Curve2 Source #

c_blst_p_is_equalPointPtr Curve2PointPtr Curve2IO Bool Source #

c_blst_p_is_infPointPtr Curve2IO Bool Source #

sizePoint_ ∷ Proxy Curve2CSize

serializedSizePoint_ ∷ Proxy Curve2CSize

compressedSizePoint_ ∷ Proxy Curve2CSize

sizeAffine_ ∷ Proxy Curve2CSize

Point / Group operations

These work on both curves, and take phantom parameters of type Curve1 or Curve2 to select one of the two provided elliptic curves.

blsInGroupBLS curve ⇒ Point curve → Bool Source #

Check whether a point is in the group corresponding to its elliptic curve

blsAddOrDoubleBLS curve ⇒ Point curve → Point curve → Point curve Source #

Curve point addition.

blsMultBLS curve ⇒ Point curve → IntegerPoint curve Source #

Scalar multiplication of a curve point. The scalar will be brought into the range of modular arithmetic by means of a modulo operation over the scalarPeriod. Negative number will also be brought to the range [0, scalarPeriod - 1] via modular reduction.

blsCnegBLS curve ⇒ Point curve → BoolPoint curve Source #

Conditional curve point negation. blsCneg x cond = if cond then neg x else x

blsNegBLS curve ⇒ Point curve → Point curve Source #

Unconditional curve point negation

blsMSM ∷ ∀ curve. BLS curve ⇒ Int → [(Integer, Point curve)] → Point curve Source #

Multi-scalar multiplication using the Pippenger algorithm. The scalars will be brought into the range of modular arithmetic by means of a modulo operation over the scalarPeriod. Negative numbers will also be brought to the range [0, scalarPeriod - 1] via modular reduction.

blsCompress ∷ ∀ curve. BLS curve ⇒ Point curve → ByteString Source #

blsSerialize ∷ ∀ curve. BLS curve ⇒ Point curve → ByteString Source #

blsUncompress ∷ ∀ curve. BLS curve ⇒ ByteStringEither BLSTError (Point curve) Source #

blsDeserialize ∷ ∀ curve. BLS curve ⇒ ByteStringEither BLSTError (Point curve) Source #

blsHashBLS curve ⇒ ByteStringMaybe ByteStringMaybe ByteStringPoint curve Source #

blsHash msg mDST mAug generates the elliptic curve blsHash for the given message msg; mDST and mAug are the optional aug and dst arguments.

blsGeneratorBLS curve ⇒ Point curve Source #

blsIsInfBLS curve ⇒ Point curve → Bool Source #

Infinity check on curve points.

PT operations

ptMultPTPTPT Source #

Pairings

The period (modulo) of scalars

scalarPeriodInteger Source #

The period of scalar modulo operations.