Example #1
0
        /// <summary>
        /// Compute multiplier (k)
        /// </summary>
        private static BigInteger ComputeMultiplier()
        {
            string one = NetUtility.ToHexString(N.ToByteArray(isUnsigned: true));
            string two = NetUtility.ToHexString(g.ToByteArray(isUnsigned: true));

            string ccstr = one + two.PadLeft(one.Length, '0');

            byte[] cc = NetUtility.FromHexString(ccstr);

            using var algorithm = GetHashAlgorithm();
            var ccHashed = algorithm.ComputeHash(cc);

            Span <char> tmp = stackalloc char[1 + NetUtility.GetHexCharCount(ccHashed.Length)];

            tmp[0] = '0'; // ensure that the value is unsigned
            NetUtility.ToHexString(ccHashed, tmp[1..]);