Example #1
0
 internal static void ReadWriteC(this BitcoinStream bs, ref BouncyCastle.Math.BigInteger integer)
 {
     if (bs.Serializing)
     {
         var str = integer.ToByteArrayUnsigned();
         bs.ReadWriteAsVarString(ref str);
     }
     else
     {
         byte[] str = null;
         bs.ReadWriteAsVarString(ref str);
         integer = new BouncyCastle.Math.BigInteger(1, str);
     }
 }
Example #2
0
        public uint256 MultiplyUint256(uint256 hSource, int iFactor)
        {
            arith256 a256 = new arith256(hSource);

            a256.MultiplyStratis((uint)iFactor);
            uint256 b256 = a256.GetUint256();

            byte[] c256in = b256.ToBytes();
            byte[] c256   = ReverseArray(c256in);
            string d256   = Encoders.Hex.EncodeData(c256);

            BouncyCastle.Math.BigInteger bi2000Divisor = new BouncyCastle.Math.BigInteger(RoundToString(1260, 0));
            BouncyCastle.Math.BigInteger b2000         = new BouncyCastle.Math.BigInteger(d256, 16);
            b2000 = b2000.Divide(bi2000Divisor);
            string  sFinal = ZeroPad(b2000.ToByteArrayUnsigned());
            uint256 hFinal = new uint256(sFinal);

            return(hFinal);
        }
Example #3
0
        public uint256 TestBed(uint256 hSource)
        {
            // 4-18-2018 R ANDREWS - BIBLEPAY - This is a testbed for multiplication
            arith256 a256 = new arith256(hSource);

            a256.MultiplyStratis(420);
            uint256 b256 = a256.GetUint256();

            byte[] c256in = b256.ToBytes();
            byte[] c256   = ReverseArray(c256in);
            string d256   = Encoders.Hex.EncodeData(c256);

            BouncyCastle.Math.BigInteger bi2000Divisor = new BouncyCastle.Math.BigInteger(RoundToString(1260, 0));
            BouncyCastle.Math.BigInteger b2000         = new BouncyCastle.Math.BigInteger(d256, 16);
            b2000 = b2000.Divide(bi2000Divisor);
            string  sFinal = ZeroPad(b2000.ToByteArrayUnsigned());
            uint256 hFinal = new uint256(sFinal);

            return(hFinal);
        }