ecRecover function
Legacy ecRecover compatibility
Implementation
Uint8List ecRecover(Uint8List hash, MsgSignature sig) {
final v = sig.v >= 27 ? sig.v - 27 : sig.v;
final signature = Uint8List(64);
final rBytes = BytesUtils.bigIntToBytes(sig.r, length: 32);
final sBytes = BytesUtils.bigIntToBytes(sig.s, length: 32);
signature.setRange(0, 32, rBytes);
signature.setRange(32, 64, sBytes);
return crypto.Secp256k1.recover(signature, hash, v);
}