BLS12FP2

Git Source

State Variables

DST_PRIME

See https://datatracker.ietf.org/doc/html/rfc9380#section-5.3.1

bytes private constant DST_PRIME = "APK-PROOF-with-BLS12377G2_XMD:SHA-256_SSWU_RO_.";

Z_PAD

See https://datatracker.ietf.org/doc/html/rfc9380#section-5.3.1

bytes private constant Z_PAD =
    hex"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";

Functions

eq

Returns true if x is equal to y.

function eq(Bls12Fp2 memory x, Bls12Fp2 memory y) internal pure returns (bool);

Parameters

NameTypeDescription
xBls12Fp2Bls12Fp2.
yBls12Fp2Bls12Fp2.

Returns

NameTypeDescription
<none>boolResult of equal check.

hash_to_field

Hash an arbitrary msg to 2 elements from field Fp2.

function hash_to_field(bytes memory message) internal view returns (Bls12Fp2[2] memory);

Parameters

NameTypeDescription
messagebytesA byte string containing the message to hash.

Returns

NameTypeDescription
<none>Bls12Fp2[2]2 of field elements.

expand_message_xmd

A uniformly random byte string using a cryptographic hash function H that outputs b bits.

function expand_message_xmd(bytes memory message) internal pure returns (bytes memory);

Parameters

NameTypeDescription
messagebytesA byte string containing the message to hash.

Returns

NameTypeDescription
<none>bytesuniform_bytes

norm

Normalize Bls12Fp2.

function norm(Bls12Fp2 memory fp2) internal view returns (Bls12Fp2 memory);

Parameters

NameTypeDescription
fp2Bls12Fp2Bls12Fp2.

Returns

NameTypeDescription
<none>Bls12Fp2fp2 % p.

debug

Debug Bls12Fp2 in bytes.

function debug(Bls12Fp2 memory fp2) internal pure returns (bytes memory);

Parameters

NameTypeDescription
fp2Bls12Fp2Bls12Fp2.

Returns

NameTypeDescription
<none>bytesUncompressed serialized bytes of Bls12Fp2.