createEurocoinMessageHash function

Uint8List createEurocoinMessageHash(
  1. String message
)

Implementation

Uint8List createEurocoinMessageHash(String message) {
  List<int> messageBytes;
  if (message.startsWith("0x")) {
    messageBytes = HEX.decode(message.substring(2));
  } else {
    messageBytes = utf8.encode(message);
  }
  final varIntLength = encodeVarint(messageBytes.length);
  final prefix = utf8.encode('\u0019Eurocoin Signed Message:\n') + varIntLength;
  final hashInput = Uint8List.fromList(prefix + messageBytes);

  return sha256Sha256Hash(hashInput);
}