当前位置: 首页>>代码示例>>C#>>正文


C# IBigInteger类代码示例

本文整理汇总了C#中IBigInteger的典型用法代码示例。如果您正苦于以下问题:C# IBigInteger类的具体用法?C# IBigInteger怎么用?C# IBigInteger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IBigInteger类属于命名空间,在下文中一共展示了IBigInteger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Generate

        public TimeStampRequest Generate(
			string		digestAlgorithmOid,
			byte[]		digest,
			IBigInteger	nonce)
        {
            if (digestAlgorithmOid == null)
            {
                throw new ArgumentException("No digest algorithm specified");
            }

            DerObjectIdentifier digestAlgOid = new DerObjectIdentifier(digestAlgorithmOid);

            AlgorithmIdentifier algID = new AlgorithmIdentifier(digestAlgOid, DerNull.Instance);
            MessageImprint messageImprint = new MessageImprint(algID, digest);

            X509Extensions  ext = null;

            if (extOrdering.Count != 0)
            {
                ext = new X509Extensions(extOrdering, extensions);
            }

            DerInteger derNonce = nonce == null
                ?	null
                :	new DerInteger(nonce);

            return new TimeStampRequest(
                new TimeStampReq(messageImprint, reqPolicy, derNonce, certReq, ext));
        }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:29,代码来源:TimeStampRequestGenerator.cs

示例2: DsaPublicBcpgKey

 public DsaPublicBcpgKey(IBigInteger p, IBigInteger q, IBigInteger g, IBigInteger y)
 {
     _p = new MPInteger(p);
     _q = new MPInteger(q);
     _g = new MPInteger(g);
     _y = new MPInteger(y);
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:DsaPublicBcpgKey.cs

示例3: NaccacheSternKeyParameters

 /**
  * @param privateKey
  */
 public NaccacheSternKeyParameters(bool privateKey, IBigInteger g, IBigInteger n, int lowerSigmaBound)
     : base(privateKey)
 {
     this.g = g;
     this.n = n;
     this.lowerSigmaBound = lowerSigmaBound;
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:10,代码来源:NaccacheSternKeyParameters.cs

示例4: ImplShamirsTrick

        private static ECPoint ImplShamirsTrick(ECPoint p, IBigInteger k, ECPoint q, IBigInteger l)
        {
            var m = System.Math.Max(k.BitLength, l.BitLength);
            var z = p.Add(q);
            var r = p.Curve.Infinity;

            for (var i = m - 1; i >= 0; --i)
            {
                r = r.Twice();

                if (k.TestBit(i))
                {
                    r = r.Add(l.TestBit(i) ? z : p);
                }
                else
                {
                    if (l.TestBit(i))
                    {
                        r = r.Add(q);
                    }
                }
            }

            return r;
        }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:25,代码来源:ECAlgorithms.cs

示例5: CreateRandomInRange

        /**
        * Return a random IBigInteger 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 IBigInteger value in the range [min,max]
        */
        public static IBigInteger CreateRandomInRange(
            IBigInteger min,
            IBigInteger max,
			// TODO Should have been just Random class
			ISecureRandom	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)
            {
                IBigInteger 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:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:40,代码来源:BigIntegers.cs

示例6: DHPrivateKeyParameters

 public DHPrivateKeyParameters(
     IBigInteger x,
     DHParameters	parameters)
     : base(true, parameters)
 {
     this.x = x;
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:DHPrivateKeyParameters.cs

示例7: Gost3410Parameters

        public Gost3410Parameters(
			IBigInteger	p,
			IBigInteger	q,
			IBigInteger	a)
            : this(p, q, a, null)
        {
        }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:GOST3410Parameters.cs

示例8: DHParameters

 public DHParameters(
     IBigInteger p,
     IBigInteger g,
     IBigInteger q)
     : this(p, g, q, 0)
 {
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:DHParameters.cs

示例9: Multiply

        /**
        * D.3.2 pg 101
        * @see org.bouncycastle.math.ec.multiplier.ECMultiplier#multiply(org.bouncycastle.math.ec.ECPoint, java.math.BigInteger)
        */
        public ECPoint Multiply(ECPoint p, IBigInteger k, IPreCompInfo preCompInfo)
        {
            // TODO Probably should try to add this
            // IBigInteger e = k.Mod(n); // n == order of p
            IBigInteger e = k;
            IBigInteger h = e.Multiply(BigInteger.Three);

            ECPoint neg = p.Negate();
            ECPoint R = p;

            for (int i = h.BitLength - 2; i > 0; --i)
            {
                R = R.Twice();

                bool hBit = h.TestBit(i);
                bool eBit = e.TestBit(i);

                if (hBit != eBit)
                {
                    R = R.Add(hBit ? p : neg);
                }
            }

            return R;
        }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:29,代码来源:FpNafMultiplier.cs

示例10: DsaParameters

 public DsaParameters(
     IBigInteger p,
     IBigInteger q,
     IBigInteger g)
     : this(p, q, g, null)
 {
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:DsaParameters.cs

示例11: RsaPrivateCrtKeyParameters

        public RsaPrivateCrtKeyParameters(
            IBigInteger modulus,
            IBigInteger publicExponent,
            IBigInteger privateExponent,
            IBigInteger p,
            IBigInteger q,
            IBigInteger dP,
            IBigInteger dQ,
            IBigInteger 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:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:25,代码来源:RsaPrivateCrtKeyParameters.cs

示例12: Init

 /**
  * Initialises the client to begin new authentication attempt
  * @param N The safe prime associated with the client's verifier
  * @param g The group parameter associated with the client's verifier
  * @param digest The digest algorithm associated with the client's verifier
  * @param random For key generation
  */
 public virtual void Init(IBigInteger N, IBigInteger g, IDigest digest, SecureRandom random)
 {
     this.N = N;
     this.g = g;
     this.digest = digest;
     this.random = random;
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:14,代码来源:SRP6Client.cs

示例13: ElGamalParameter

 public ElGamalParameter(
     IBigInteger	p,
     IBigInteger	g)
 {
     this.p = new DerInteger(p);
     this.g = new DerInteger(g);
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:ElGamalParameter.cs

示例14: Generate

 public TimeStampResponse Generate(
     TimeStampRequest request,
     IBigInteger serialNumber,
     DateTime genTime)
 {
     return Generate(request, serialNumber, new DateTimeObject(genTime));
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:TimeStampResponseGenerator.cs

示例15: IssuerAndSerialNumber

 public IssuerAndSerialNumber(
     X509Name	name,
     IBigInteger	serialNumber)
 {
     this.name = name;
     this.serialNumber = new DerInteger(serialNumber);
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:IssuerAndSerialNumber.cs


注:本文中的IBigInteger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。