BLS12FP2
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
Name | Type | Description |
---|---|---|
x | Bls12Fp2 | Bls12Fp2. |
y | Bls12Fp2 | Bls12Fp2. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | Result 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
Name | Type | Description |
---|---|---|
message | bytes | A byte string containing the message to hash. |
Returns
Name | Type | Description |
---|---|---|
<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
Name | Type | Description |
---|---|---|
message | bytes | A byte string containing the message to hash. |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | uniform_bytes |
norm
Normalize Bls12Fp2.
function norm(Bls12Fp2 memory fp2) internal view returns (Bls12Fp2 memory);
Parameters
Name | Type | Description |
---|---|---|
fp2 | Bls12Fp2 | Bls12Fp2. |
Returns
Name | Type | Description |
---|---|---|
<none> | Bls12Fp2 | fp2 % p . |
debug
Debug Bls12Fp2 in bytes.
function debug(Bls12Fp2 memory fp2) internal pure returns (bytes memory);
Parameters
Name | Type | Description |
---|---|---|
fp2 | Bls12Fp2 | Bls12Fp2. |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | Uncompressed serialized bytes of Bls12Fp2. |