public string SingGen(byte[] h, BigInteger d) { BigInteger alpha = BigInteger.Parse(SupportEDS.DecStringFromByteArray(h)); BigInteger e = alpha % this.curv.N; if (e == 0) { e = 1; } BigInteger k = new BigInteger(); EllipticCurve_Point C = new EllipticCurve_Point(); BigInteger r = new BigInteger(); BigInteger s = new BigInteger(); do { Random rnd = new Random(); do { k = Maths.RandBigInteger(Maths.Length(this.curv.N), rnd); }while ((k < 0) || (k > this.curv.N)); curv.Mult(k, this.curv.G, ref C); r = C.X % this.curv.N; s = ((r * d) + (k * e)) % this.curv.N; }while ((r == 0) || (s == 0)); int midl = Maths.Length(this.curv.N) / 4; string Rvector = SupportEDS.Add0PaddingToString(r.ToString("X"), midl); string Svector = SupportEDS.Add0PaddingToString(s.ToString("X"), midl); return(Rvector + Svector); }