Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Element = Element {
- unElement :: Point2
- add :: Element -> Element -> Element
- neg :: Element -> Element
- scalarMul :: Integer -> Element -> Element
- hashToGroup :: ByteString -> ByteString -> Either BLS12_381_Error Element
- compress :: Element -> ByteString
- uncompress :: ByteString -> Either BLSTError Element
- offchain_zero :: Element
- compressed_zero :: ByteString
- compressed_generator :: ByteString
- memSizeBytes :: Int
- compressedSizeBytes :: Int
Documentation
See Note [Wrapping the BLS12-381 types in Plutus Core].
Instances
compress :: Element -> ByteString Source #
Compress a G2 element to a bytestring. This serialises a curve point to its x coordinate only, using an extra bit to determine which of two possible y coordinates the point has. The compressed bytestring is 96 bytes long. See https://github.com/supranational/blst#serialization-format
uncompress :: ByteString -> Either BLSTError Element Source #
Uncompress a bytestring to get a G2 point. This will fail if any of the following are true: * The bytestring is not exactly 96 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 E2 curve * The bytestring does represent a point on the E2 curve, but the point is not in the G2 subgroup
offchain_zero :: Element Source #
The zero element of G2. This cannot be flat-serialised and is provided only for off-chain testing.
compressed_zero :: ByteString Source #
The zero element of G2 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 G2 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 G2 point (288 bytes)
compressedSizeBytes :: Int Source #
Compressed size of a G2 point (96 bytes)