sign function
Sign Hash
Implementation
Uint8List sign(Uint8List hash, Uint8List x) {
if (!isScalar(hash)) throw ArgumentError(_throwBadHash);
if (!isPrivate(x)) throw ArgumentError(_throwBadPrivate);
ECSignature sig = deterministicGenerateK(hash, x);
Uint8List buffer = Uint8List(64);
buffer.setRange(0, 32, _encodeBigInt(sig.r));
BigInt s;
if (sig.s.compareTo(_nDiv2) > 0) {
s = _n - sig.s;
} else {
s = sig.s;
}
buffer.setRange(32, 64, _encodeBigInt(s));
return buffer;
}