toBytes method

List<int> toBytes([
  1. EncodeType encodeType = EncodeType.comprossed
])

Converts the elliptic curve point to a byte array with the specified encoding type. The default encoding type is 'compressed'.

Implementation

List<int> toBytes([EncodeType encodeType = EncodeType.comprossed]) {
  if (this is EDPoint) {
    return _edwardsEncode();
  }
  switch (encodeType) {
    case EncodeType.raw:
      return _encode();
    case EncodeType.uncompressed:
      return List<int>.from([0x04, ..._encode()]);
    case EncodeType.hybrid:
      return _hybridEncode();
    default:
      return _compressedEncode();
  }
}