cardano-crypto-class-2.2.0.0: Type classes abstracting over cryptography primitives for Cardano
Safe HaskellNone
LanguageHaskell2010

Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Synopsis

Unsafe Types

newtype PointPtr curve Source #

Constructors

PointPtr (Ptr Void) 

data AffinePtr curve Source #

Instances

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

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Methods

(==)AffinePtr curve → AffinePtr curve → Bool Source #

(/=)AffinePtr curve → AffinePtr curve → Bool Source #

Phantom Types

Error codes

Safe types

data Affine curve Source #

Instances

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

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Methods

(==)Affine curve → Affine curve → Bool Source #

(/=)Affine curve → Affine curve → Bool Source #

data BLSTError Source #

Instances

Instances details
Bounded BLSTError Source # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Enum BLSTError Source # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Show BLSTError Source # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Eq BLSTError Source # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Ord BLSTError Source # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

newtype Point curve Source #

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

Constructors

Point (ForeignPtr Void) 

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 Source #

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

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 Source #

(/=)PTPTBool Source #

newtype Scalar Source #

Constructors

Scalar (ForeignPtr Void) 

Instances

Instances details
Eq Scalar Source # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Methods

(==)ScalarScalarBool Source #

(/=)ScalarScalarBool Source #

newtype Fr Source #

Constructors

Fr (ForeignPtr Void) 

Instances

Instances details
Eq Fr Source # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Methods

(==)FrFrBool Source #

(/=)FrFrBool Source #

The period of scalars

scalarPeriodInteger Source #

The period of scalar modulo operations.

Curve abstraction

class BLS curve where 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.

Methods

c_blst_on_curvePointPtr curve → IO Bool Source #

c_blst_add_or_doublePointPtr curve → PointPtr curve → PointPtr curve → IO () Source #

c_blst_multPointPtr curve → PointPtr curve → ScalarPtrCSizeIO () Source #

c_blst_cnegPointPtr curve → BoolIO () Source #

c_blst_hashPointPtr curve → Ptr CCharCSizePtr CCharCSizePtr CCharCSizeIO () Source #

c_blst_compressPtr CCharPointPtr curve → IO () Source #

c_blst_serializePtr CCharPointPtr curve → IO () Source #

c_blst_uncompressAffinePtr curve → Ptr CCharIO CInt Source #

c_blst_deserializeAffinePtr curve → Ptr CCharIO CInt Source #

c_blst_in_gPointPtr curve → IO Bool Source #

c_blst_to_affineAffinePtr curve → PointPtr curve → IO () Source #

c_blst_from_affinePointPtr curve → AffinePtr curve → IO () Source #

c_blst_affine_in_gAffinePtr curve → IO Bool Source #

c_blst_generatorPointPtr curve Source #

c_blst_p_is_equalPointPtr curve → PointPtr curve → IO Bool Source #

c_blst_p_is_infPointPtr curve → IO Bool Source #

Instances

Instances details
BLS Curve1 Source # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

BLS Curve2 Source # 
Instance details

Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal

Pairing check

FP12 functions

Scalar functions

Marshalling functions

sizePoint ∷ ∀ curve. BLS curve ⇒ Proxy curve → Int Source #

Sizes of various representations of elliptic curve points. | Size of a curve point in memory

withPoint ∷ ∀ a curve. Point curve → (PointPtr curve → IO a) → IO a Source #

withNewPoint ∷ ∀ curve a. BLS curve ⇒ (PointPtr curve → IO a) → IO (a, Point curve) Source #

withNewPoint_BLS curve ⇒ (PointPtr curve → IO a) → IO a Source #

withNewPoint'BLS curve ⇒ (PointPtr curve → IO a) → IO (Point curve) Source #

clonePoint ∷ ∀ curve. BLS curve ⇒ Point curve → IO (Point curve) Source #

compressedSizePoint ∷ ∀ curve. BLS curve ⇒ Proxy curve → Int Source #

Size of a curved point when serialized in compressed form

serializedSizePoint ∷ ∀ curve. BLS curve ⇒ Proxy curve → Int Source #

Size of a curved point when serialized in uncompressed form

sizeAffine ∷ ∀ curve. BLS curve ⇒ Proxy curve → Int Source #

In-memory size of the affine representation of a curve point

withAffine ∷ ∀ a curve. Affine curve → (AffinePtr curve → IO a) → IO a Source #

withNewAffine ∷ ∀ curve a. BLS curve ⇒ (AffinePtr curve → IO a) → IO (a, Affine curve) Source #

withNewAffine_BLS curve ⇒ (AffinePtr curve → IO a) → IO a Source #

withNewAffine'BLS curve ⇒ (AffinePtr curve → IO a) → IO (Affine curve) Source #

withPTPT → (PTPtrIO a) → IO a Source #

withNewPT ∷ (PTPtrIO a) → IO (a, PT) Source #

withNewPT_ ∷ (PTPtrIO a) → IO a Source #

withNewPT' ∷ (PTPtrIO a) → IO PT Source #

withScalarScalar → (ScalarPtrIO a) → IO a Source #

withNewScalar ∷ (ScalarPtrIO a) → IO (a, Scalar) Source #

withNewScalar_ ∷ (ScalarPtrIO a) → IO a Source #

withFrFr → (FrPtr → IO a) → IO a Source #

withNewFr ∷ (FrPtr → IO a) → IO (a, Fr) Source #

withNewFr_ ∷ (FrPtr → IO a) → IO a Source #

withNewFr' ∷ (FrPtr → IO a) → IO Fr Source #

Utility

integerAsCStrLIntInteger → (Ptr CCharIntIO a) → IO a Source #

Point1/G1 operations

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

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.

blsZero ∷ ∀ curve. BLS curve ⇒ Point curve Source #

toAffineBLS curve ⇒ Point curve → Affine curve Source #

fromAffineBLS curve ⇒ Affine curve → Point curve Source #

affineInGBLS curve ⇒ Affine curve → Bool Source #

PT operations

ptMultPTPTPT Source #

Scalar / Fr operations

Pairings