Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Point curve
- type Point1 = Point Curve1
- type Point2 = Point Curve2
- data PT
- data Curve1
- data Curve2
- data BLSTError
- class BLS curve
- blsInGroup ∷ BLS curve ⇒ Point curve → Bool
- blsAddOrDouble ∷ BLS curve ⇒ Point curve → Point curve → Point curve
- blsMult ∷ BLS curve ⇒ Point curve → Integer → Point curve
- blsCneg ∷ BLS curve ⇒ Point curve → Bool → Point curve
- blsNeg ∷ BLS curve ⇒ Point curve → Point curve
- blsCompress ∷ ∀ curve. BLS curve ⇒ Point curve → ByteString
- blsSerialize ∷ ∀ curve. BLS curve ⇒ Point curve → ByteString
- blsUncompress ∷ ∀ curve. BLS curve ⇒ ByteString → Either BLSTError (Point curve)
- blsDeserialize ∷ ∀ curve. BLS curve ⇒ ByteString → Either BLSTError (Point curve)
- blsHash ∷ BLS curve ⇒ ByteString → Maybe ByteString → Maybe ByteString → Point curve
- blsGenerator ∷ BLS curve ⇒ Point curve
- blsIsInf ∷ BLS curve ⇒ Point curve → Bool
- ptMult ∷ PT → PT → PT
- ptFinalVerify ∷ PT → PT → Bool
- millerLoop ∷ Point1 → Point2 → PT
- scalarPeriod ∷ Integer
Types
A point on an elliptic curve. This type guarantees that the point is part of the | prime order subgroup.
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
BLST_SUCCESS | |
BLST_BAD_ENCODING | |
BLST_POINT_NOT_ON_CURVE | |
BLST_POINT_NOT_IN_GROUP | |
BLST_AGGR_TYPE_MISMATCH | |
BLST_VERIFY_FAIL | |
BLST_PK_IS_INFINITY | |
BLST_BAD_SCALAR | |
BLST_UNKNOWN_ERROR |
Instances
Bounded BLSTError Source # | |
Enum BLSTError Source # | |
Defined in Cardano.Crypto.EllipticCurve.BLS12_381.Internal succ ∷ BLSTError → BLSTError Source # pred ∷ BLSTError → BLSTError Source # toEnum ∷ Int → BLSTError Source # fromEnum ∷ BLSTError → Int Source # enumFrom ∷ BLSTError → [BLSTError] Source # enumFromThen ∷ BLSTError → BLSTError → [BLSTError] Source # enumFromTo ∷ BLSTError → BLSTError → [BLSTError] Source # enumFromThenTo ∷ BLSTError → BLSTError → BLSTError → [BLSTError] Source # | |
Show BLSTError Source # | |
Eq BLSTError Source # | |
Ord BLSTError Source # | |
BLS Class
BLS curve operations. Class methods are low-level; user code will want to
use higher-level wrappers such as blsAddOrDouble
, blsMult
, blsCneg
, blsNeg
, etc.
c_blst_on_curve, c_blst_add_or_double, c_blst_mult, c_blst_cneg, c_blst_hash, c_blst_compress, c_blst_serialize, c_blst_uncompress, c_blst_deserialize, c_blst_in_g, c_blst_to_affine, c_blst_from_affine, c_blst_affine_in_g, c_blst_generator, c_blst_p_is_equal, c_blst_p_is_inf, sizePoint_, serializedSizePoint_, compressedSizePoint_, sizeAffine_
Instances
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 Source #
Check whether a point is in the group corresponding to its elliptic curve
blsMult ∷ BLS curve ⇒ Point curve → Integer → Point 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.
blsCneg ∷ BLS curve ⇒ Point curve → Bool → Point curve Source #
Conditional curve point negation.
blsCneg x cond = if cond then neg x else x
blsCompress ∷ ∀ curve. BLS curve ⇒ Point curve → ByteString Source #
blsSerialize ∷ ∀ curve. BLS curve ⇒ Point curve → ByteString Source #
blsUncompress ∷ ∀ curve. BLS curve ⇒ ByteString → Either BLSTError (Point curve) Source #
blsDeserialize ∷ ∀ curve. BLS curve ⇒ ByteString → Either BLSTError (Point curve) Source #
blsHash ∷ BLS curve ⇒ ByteString → Maybe ByteString → Maybe ByteString → Point 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.
blsGenerator ∷ BLS curve ⇒ Point curve Source #
PT operations
Pairings
The period (modulo) of scalars
scalarPeriod ∷ Integer Source #
The period of scalar modulo operations.