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

Cardano.Crypto.EllipticCurve.BLS12_381

Synopsis

Types

data Point curve #

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) # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Methods

(==) :: Point curve -> Point curve -> Bool Source #

(/=) :: Point curve -> Point curve -> Bool Source #

data PT #

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 # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Methods

(==) :: PT -> PT -> Bool Source #

(/=) :: PT -> PT -> Bool Source #

data BLSTError #

Instances

Instances details
Bounded BLSTError # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Enum BLSTError # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Show BLSTError # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Eq BLSTError # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Ord BLSTError # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

BLS Class

class BLS curve #

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 # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

BLS Curve2 # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

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.

blsInGroup :: BLS curve => Point curve -> Bool #

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

blsAddOrDouble :: BLS curve => Point curve -> Point curve -> Point curve #

Curve point addition.

blsMult :: BLS curve => Point curve -> Integer -> Point curve #

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.

blsCneg :: BLS curve => Point curve -> Bool -> Point curve #

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

blsNeg :: BLS curve => Point curve -> Point curve #

Unconditional curve point negation

blsCompress :: forall curve. BLS curve => Point curve -> ByteString #

blsSerialize :: forall curve. BLS curve => Point curve -> ByteString #

blsUncompress :: forall curve. BLS curve => ByteString -> Either BLSTError (Point curve) #

blsDeserialize :: forall curve. BLS curve => ByteString -> Either BLSTError (Point curve) #

blsHash :: BLS curve => ByteString -> Maybe ByteString -> Maybe ByteString -> Point curve #

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

blsGenerator :: BLS curve => Point curve #

blsIsInf :: BLS curve => Point curve -> Bool #

Infinity check on curve points.

PT operations

ptMult :: PT -> PT -> PT #

Pairings

The period (modulo) of scalars

scalarPeriod :: Integer #

The period of scalar modulo operations.