private BigInteger ComputeSchnorrE(byte[] rba, EllipticCurvePoint P, byte[] hash) { // Compute "tagged hash": // tagHash = Sha256(tagstring) // msg = R.X | P.X | hash // return sha256(tagHash | tagHash | msg) using Sha256 sha = new Sha256(); byte[] pba = P.X.ToByteArray(true, true); // TODO: change all these BigIntegers to ModUint256 type so that it doesn't need length checks,...! byte[] pubBa = new byte[32]; Buffer.BlockCopy(pba, 0, pubBa, 32 - pba.Length, pba.Length); BigInteger e = sha.ComputeTaggedHash_BIPSchnorr(rba, pubBa, hash).ToBigInt(true, true) % curve.N; return(e); }