static Context CreateInstance()
        {
            var gen = new ECMultGenContext();

            gen.Blind(RandomUtils.GetBytes(32));
            return(new Context(new ECMultContext(), gen));
        }
            public uint256 BlindMessage(uint256 message, PubKey rpubkey, PubKey signerPubKey)
            {
                var         ctx = new ECMultGenContext();
                int         overflow;
                Span <byte> tmp = stackalloc byte[32];

                if (!Context.Instance.TryCreatePubKey(signerPubKey.ToBytes(), out var signerECPubkey))
                {
                    throw new FormatException("Invalid signer pubkey.");
                }
                if (!Context.Instance.TryCreatePubKey(rpubkey.ToBytes(), out var rECPubKey))
                {
                    throw new FormatException("Invalid r pubkey.");
                }
                var P = signerECPubkey.Q;
                var R = rECPubKey.Q.ToGroupElementJacobian();
                var t = FE.Zero;

retry:

                RandomUtils.GetBytes(tmp);
                _v = new Scalar(tmp, out overflow);
                if (overflow != 0 || _v.IsZero)
                {
                    goto retry;
                }
                RandomUtils.GetBytes(tmp);
                _w = new Scalar(tmp, out overflow);
                if (overflow != 0 || _v.IsZero)
                {
                    goto retry;
                }
                var A1 = ctx.MultGen(_v);
                var A2 = _w * P;
                var A  = R.AddVariable(A1, out _).AddVariable(A2, out _).ToGroupElement();

                t = A.x.Normalize();
                if (t.IsZero)
                {
                    goto retry;
                }
                using (var sha = new SHA256())
                {
                    message.ToBytes(tmp, false);
                    sha.Write(tmp);
                    t.WriteToSpan(tmp);
                    sha.Write(tmp);
                    sha.GetHash(tmp);
                }
                _c = new Scalar(tmp, out overflow);
                if (overflow != 0 || _c.IsZero)
                {
                    goto retry;
                }
                var cp = _c.Add(_w.Negate(), out overflow);                 // this is sent to the signer (blinded message)

                if (cp.IsZero || overflow != 0)
                {
                    goto retry;
                }
                cp.WriteToSpan(tmp);
                return(new uint256(tmp));
            }