BigInteger.ToHexString C# (CSharp) Method

ToHexString() public method

public ToHexString ( ) : string
return string
        public string ToHexString()
        {
                string result = data[dataLength - 1].ToString("X");

                for(int i = dataLength - 2; i >= 0; i--)
                {
                        result += data[i].ToString("X8");
                }

                return result;
        }

Usage Example

示例#1
1
        //формирование цифровой подписи.
        public string genDS(byte[] h, BigInteger d)
        {
            BigInteger a = new BigInteger(h);
            BigInteger e = a % n;
            if (e == 0)
                e = 1;
            BigInteger k = new BigInteger();
            CECPoint C=new CECPoint();
            BigInteger r=new BigInteger();
            BigInteger s = new BigInteger();
            do
            {
                do
                {
                    k.genRandomBits(n.bitCount(), new Random());
                } 
                while ((k < 0) || (k > n));

                C = CECPoint.multiply(G, k);
                r = C.x % n;
                s = ((r * d) + (k * e)) % n;
            } 
            while ((r == 0)||(s==0));

            string Rvector = padding(r.ToHexString(), n.bitCount() / 4);
            string Svector = padding(s.ToHexString(), n.bitCount() / 4);
            return Rvector + Svector;
        }
All Usage Examples Of BigInteger::ToHexString