verify function

bool verify(
  1. List<int> public,
  2. List<int> message,
  3. List<int> signature, {
  4. ED448_XOF xof = shake_256,
})

Implementation

bool verify(
  List<int> public,
  List<int> message,
  List<int> signature,
  {ED448_XOF xof = shake_256}
) {
  if (public.length != 57) {
    throw FormatException("Bad public key length");
  }

  if (signature.length != 114) {
    throw FormatException("Bad signature length");
  }

  final A = _pointDecompress(public);
  if (A == null) {
    return false;
  }

  final Rs = signature.sublist(0, 57);
  final R = _pointDecompress(Rs);
  if (R == null) {
      return false;
  }

  final s = _asLE(signature.sublist(57, 114));
  if (s >= q) {
    return false;
  }

  final h = _xofModQ(xof, MARKER + [0] + [0] + Rs + public + message, 114);
  var sB = _pointMultiply(s, _G);
  var hA = _pointMultiply(h, A);

  return _pointEqual(sB, _pointAdd(R, hA));
}