當前位置: 首頁>>代碼示例>>C#>>正文


C# Math.BigInteger類代碼示例

本文整理匯總了C#中NBitcoin.BouncyCastle.Math.BigInteger的典型用法代碼示例。如果您正苦於以下問題:C# BigInteger類的具體用法?C# BigInteger怎麽用?C# BigInteger使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BigInteger類屬於NBitcoin.BouncyCastle.Math命名空間,在下文中一共展示了BigInteger類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DHPrivateKeyParameters

		public DHPrivateKeyParameters(
            BigInteger		x,
            DHParameters	parameters)
			: base(true, parameters)
        {
            this.x = x;
        }
開發者ID:woutersmit,項目名稱:NBitcoin,代碼行數:7,代碼來源:DHPrivateKeyParameters.cs

示例2: IssuerAndSerialNumber

 public IssuerAndSerialNumber(
     X509Name	name,
     BigInteger	serialNumber)
 {
     this.name = name;
     this.serialNumber = new DerInteger(serialNumber);
 }
開發者ID:woutersmit,項目名稱:NBitcoin,代碼行數:7,代碼來源:IssuerAndSerialNumber.cs

示例3: RsaPrivateCrtKeyParameters

		public RsaPrivateCrtKeyParameters(
            BigInteger	modulus,
            BigInteger	publicExponent,
            BigInteger	privateExponent,
            BigInteger	p,
            BigInteger	q,
            BigInteger	dP,
            BigInteger	dQ,
            BigInteger	qInv)
			: base(true, modulus, privateExponent)
        {
			ValidateValue(publicExponent, "publicExponent", "exponent");
			ValidateValue(p, "p", "P value");
			ValidateValue(q, "q", "Q value");
			ValidateValue(dP, "dP", "DP value");
			ValidateValue(dQ, "dQ", "DQ value");
			ValidateValue(qInv, "qInv", "InverseQ value");

			this.e = publicExponent;
            this.p = p;
            this.q = q;
            this.dP = dP;
            this.dQ = dQ;
            this.qInv = qInv;
        }
開發者ID:woutersmit,項目名稱:NBitcoin,代碼行數:25,代碼來源:RsaPrivateCrtKeyParameters.cs

示例4: GenerateSignature

		/**
		 * generate a signature for the given message using the key we were
		 * initialised with. For conventional Gost3410 the message should be a Gost3411
		 * hash of the message of interest.
		 *
		 * @param message the message that will be verified later.
		 */
		public BigInteger[] GenerateSignature(
			byte[] message)
		{
			byte[] mRev = new byte[message.Length]; // conversion is little-endian
			for (int i = 0; i != mRev.Length; i++)
			{
				mRev[i] = message[mRev.Length - 1 - i];
			}

			BigInteger m = new BigInteger(1, mRev);
			Gost3410Parameters parameters = key.Parameters;
			BigInteger k;

			do
			{
				k = new BigInteger(parameters.Q.BitLength, random);
			}
			while (k.CompareTo(parameters.Q) >= 0);

			BigInteger r = parameters.A.ModPow(k, parameters.P).Mod(parameters.Q);

			BigInteger s = k.Multiply(m).
				Add(((Gost3410PrivateKeyParameters)key).X.Multiply(r)).
				Mod(parameters.Q);

			return new BigInteger[]{ r, s };
		}
開發者ID:woutersmit,項目名稱:NBitcoin,代碼行數:34,代碼來源:GOST3410Signer.cs

示例5: DsaParameters

		public DsaParameters(
            BigInteger	p,
            BigInteger	q,
            BigInteger	g)
			: this(p, q, g, null)
        {
        }
開發者ID:woutersmit,項目名稱:NBitcoin,代碼行數:7,代碼來源:DsaParameters.cs

示例6: CreateRandomInRange

		/**
        * Return a random BigInteger not less than 'min' and not greater than 'max'
        * 
        * @param min the least value that may be generated
        * @param max the greatest value that may be generated
        * @param random the source of randomness
        * @return a random BigInteger value in the range [min,max]
        */
		public static BigInteger CreateRandomInRange(
			BigInteger min,
			BigInteger max,
			// TODO Should have been just Random class
			SecureRandom random)
		{
			int cmp = min.CompareTo(max);
			if(cmp >= 0)
			{
				if(cmp > 0)
					throw new ArgumentException("'min' may not be greater than 'max'");

				return min;
			}

			if(min.BitLength > max.BitLength / 2)
			{
				return CreateRandomInRange(BigInteger.Zero, max.Subtract(min), random).Add(min);
			}

			for(int i = 0; i < MaxIterations; ++i)
			{
				BigInteger x = new BigInteger(max.BitLength, random);
				if(x.CompareTo(min) >= 0 && x.CompareTo(max) <= 0)
				{
					return x;
				}
			}

			// fall back to a faster (restricted) method
			return new BigInteger(max.Subtract(min).BitLength - 1, random).Add(min);
		}
開發者ID:Nethereum,項目名稱:Nethereum,代碼行數:40,代碼來源:BigIntegers.cs

示例7: NaccacheSternKeyParameters

		/**
		 * @param privateKey
		 */
		public NaccacheSternKeyParameters(bool privateKey, BigInteger g, BigInteger n, int lowerSigmaBound)
			: base(privateKey)
		{
			this.g = g;
			this.n = n;
			this.lowerSigmaBound = lowerSigmaBound;
		}
開發者ID:woutersmit,項目名稱:NBitcoin,代碼行數:10,代碼來源:NaccacheSternKeyParameters.cs

示例8: ElGamalParameter

		public ElGamalParameter(
            BigInteger	p,
            BigInteger	g)
        {
            this.p = new DerInteger(p);
            this.g = new DerInteger(g);
        }
開發者ID:woutersmit,項目名稱:NBitcoin,代碼行數:7,代碼來源:ElGamalParameter.cs

示例9: ECDomainParameters

 public ECDomainParameters(
     ECCurve     curve,
     ECPoint     g,
     BigInteger  n)
     : this(curve, g, n, BigInteger.One)
 {
 }
開發者ID:woutersmit,項目名稱:NBitcoin,代碼行數:7,代碼來源:ECDomainParameters.cs

示例10: DHParameters

		public DHParameters(
			BigInteger	p,
			BigInteger	g,
			BigInteger	q)
			: this(p, g, q, 0)
		{
		}
開發者ID:woutersmit,項目名稱:NBitcoin,代碼行數:7,代碼來源:DHParameters.cs

示例11: X9ECParameters

 public X9ECParameters(
     ECCurve		curve,
     ECPoint		g,
     BigInteger	n)
     : this(curve, g, n, BigInteger.One, null)
 {
 }
開發者ID:woutersmit,項目名稱:NBitcoin,代碼行數:7,代碼來源:X9ECParameters.cs

示例12: Gost3410Parameters

		public Gost3410Parameters(
			BigInteger	p,
			BigInteger	q,
			BigInteger	a)
			: this(p, q, a, null)
		{
		}
開發者ID:woutersmit,項目名稱:NBitcoin,代碼行數:7,代碼來源:GOST3410Parameters.cs

示例13: X9ECParameters

		public X9ECParameters(
			ECCurve curve,
			X9ECPoint g,
			BigInteger n,
			BigInteger h)
			: this(curve, g, n, h, null)
		{
		}
開發者ID:Nethereum,項目名稱:Nethereum,代碼行數:8,代碼來源:X9ECParameters.cs

示例14: DerInteger

		public DerInteger(
            BigInteger value)
        {
            if (value == null)
                throw new ArgumentNullException("value");

			bytes = value.ToByteArray();
        }
開發者ID:woutersmit,項目名稱:NBitcoin,代碼行數:8,代碼來源:DerInteger.cs

示例15: MacData

		public MacData(
            DigestInfo	digInfo,
            byte[]		salt,
            int			iterationCount)
        {
            this.digInfo = digInfo;
            this.salt = (byte[]) salt.Clone();
            this.iterationCount = BigInteger.ValueOf(iterationCount);
        }
開發者ID:woutersmit,項目名稱:NBitcoin,代碼行數:9,代碼來源:MacData.cs


注:本文中的NBitcoin.BouncyCastle.Math.BigInteger類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。