public class BLS12_381Serialization
extends java.lang.Object
G1 compressed encoding is 48 bytes; G2 compressed encoding is 96 bytes. The high three bits of the first byte are flags:
(c1, c0) — the imaginary
part first.
The y-sign flag uses the lexicographic ordering of the encoded
y versus -y: for Fp this reduces to y > (p-1)/2,
for Fp² to "y.c1 > (p-1)/2, or y.c0 > (p-1)/2 when
y.c1 == 0".
Decompression validates the curve equation and the flag combinations but
does not perform a prime-order subgroup check — callers that
need a validated public key or
a subgroup-checked signature should do that explicitly.
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
compressG1(ECPoint point)
Compress a G1 point to its 48-byte Zcash-format encoding.
|
static byte[] |
compressG2(BLS12_381G2Point point)
Compress a G2 point to its 96-byte Zcash-format encoding.
|
static ECPoint |
decompressG1(byte[] bytes,
ECCurve curve)
Decompress a 48-byte Zcash-format encoding back to a G1 point on the
supplied curve.
|
static BLS12_381G2Point |
decompressG2(byte[] bytes)
Decompress a 96-byte Zcash-format encoding back to a G2 point.
|
public static byte[] compressG1(ECPoint point)
public static ECPoint decompressG1(byte[] bytes, ECCurve curve)
public static byte[] compressG2(BLS12_381G2Point point)
public static BLS12_381G2Point decompressG2(byte[] bytes)
(x, y) satisfies the G2 curve equation; does not
subgroup-check.