plutus-core-1.36.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusCore.Crypto.BLS12_381.G1

Synopsis

Documentation

newtype Element Source #

Constructors

Element 

Fields

Instances

Instances details
Show Element Source # 
Instance details

Defined in PlutusCore.Crypto.BLS12_381.G1

NFData Element Source # 
Instance details

Defined in PlutusCore.Crypto.BLS12_381.G1

Methods

rnf :: Element -> () Source #

Flat Element Source #

We don't support direct flat encoding of G2 elements because of the expense of on-chain uncompression. Users should convert between G2 elements and bytestrings using compress and uncompress: the bytestrings can be flat-encoded in the usual way.

Instance details

Defined in PlutusCore.Crypto.BLS12_381.G1

Methods

encode :: Element -> Encoding

decode :: Get Element

size :: Element -> NumBits -> NumBits

Eq Element Source # 
Instance details

Defined in PlutusCore.Crypto.BLS12_381.G1

Hashable Element Source # 
Instance details

Defined in PlutusCore.Crypto.BLS12_381.G1

Methods

hashWithSalt :: Int -> Element -> Int

hash :: Element -> Int

ExMemoryUsage Element Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.ExMemoryUsage

Pretty Element Source # 
Instance details

Defined in PlutusCore.Crypto.BLS12_381.G1

Methods

pretty :: Element -> Doc ann #

prettyList :: [Element] -> Doc ann #

PrettyBy ConstConfig Element Source # 
Instance details

Defined in PlutusCore.Crypto.BLS12_381.G1

Methods

prettyBy :: ConstConfig -> Element -> Doc ann #

prettyListBy :: ConstConfig -> [Element] -> Doc ann #

KnownBuiltinTypeIn DefaultUni term Element => MakeKnownIn DefaultUni term Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Element => ReadKnownIn DefaultUni term Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Element Source #

Contains DefaultUni Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeAst tyname DefaultUni Element => KnownTypeAst tyname DefaultUni Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

type IsBuiltin DefaultUni Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

add :: Element -> Element -> Element Source #

Add two G1 group elements

neg :: Element -> Element Source #

Negate a G1 group element

scalarMul :: Integer -> Element -> Element Source #

Multiplication of group elements by scalars. In the blst library the arguments are the other way round, but scalars acting on the left is more consistent with standard mathematical practice.

hashToGroup :: ByteString -> ByteString -> Either BLS12_381_Error Element Source #

Take an arbitrary bytestring and a Domain Separation Tag (DST) and hash them to a get point in G1.

compress :: Element -> ByteString Source #

Compress a G1 element to a bytestring. This serialises a curve point to its x coordinate only. The compressed bytestring is 48 bytes long, with three spare bits used to convey extra information about the point, including determining which of two possible y coordinates the point has and whether the point is the point at infinity. See https://github.com/supranational/blst#serialization-format

uncompress :: ByteString -> Either BLSTError Element Source #

Uncompress a bytestring to get a G1 point. This will fail if any of the following are true. * The bytestring is not exactly 48 bytes long. * The most significant three bits are used incorrectly. * The bytestring encodes a field element which is not the x coordinate of a point on the E1 curve. * The bytestring does represent a point on the E1 curve, but the point is not in the G1 subgroup.

offchain_zero :: Element Source #

The zero element of G1. This cannot be flat-serialised and is provided only for off-chain testing.

compressed_zero :: ByteString Source #

The zero element of G1 compressed into a bytestring. This is provided for convenience in PlutusTx and is not exported as a builtin.

compressed_generator :: ByteString Source #

The standard generator of G1 compressed into a bytestring. This is provided for convenience in PlutusTx and is not exported as a builtin.

memSizeBytes :: Int Source #

Memory usage of a G1 point (144 bytes)

compressedSizeBytes :: Int Source #

Compressed size of a G1 point (48 bytes)