pointAddScalar function

Uint8List? pointAddScalar(
  1. Uint8List p,
  2. Uint8List tweak,
  3. bool _compressed
)

Point Add Scalar

Implementation

Uint8List? pointAddScalar(Uint8List p, Uint8List tweak, bool _compressed) {
  if (!isPoint(p)) throw ArgumentError(_throwBadPoint);
  if (!isOrderScalar(tweak)) throw ArgumentError(_throwBadTweak);
  bool compressed = assumeCompression(_compressed, p);
  ECPoint? pp = decodeFrom(p);
  if (_compare(tweak, _zero32) == 0) return getEncoded(pp, compressed);
  BigInt tt = fromBuffer(tweak);
  ECPoint qq = (_g * tt) as ECPoint;
  ECPoint uu = (pp! + qq) as ECPoint;
  if (uu.isInfinity) return null;
  return getEncoded(uu, compressed);
}