toHex method
Encode point to hex string.
Implementation
String toHex([bool isCompressed = true]) {
// convert to 2d xy affine point
final affinePointValue = affinePoint();
final (BigInt x, BigInt y) = (affinePointValue.x, affinePointValue.y);
// 0x02, 0x03, 0x04 prefix
final head = isCompressed ? ((y & BigInt.one) == BigInt.zero ? '02' : '03') : '04';
// prefix||x and ||y
return head + Utilities.bigIntToHex(x) + (isCompressed ? '' : Utilities.bigIntToHex(y));
}