本文整理汇总了C#中NBitcoin.BouncyCastle.Math.BigInteger类的典型用法代码示例。如果您正苦于以下问题:C# BigInteger类的具体用法?C# BigInteger怎么用?C# BigInteger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BigInteger类属于NBitcoin.BouncyCastle.Math命名空间,在下文中一共展示了BigInteger类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: DsaParameter
public DsaParameter(
BigInteger p,
BigInteger q,
BigInteger g)
{
this.p = new DerInteger(p);
this.q = new DerInteger(q);
this.g = new DerInteger(g);
}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:9,代码来源:DSAParameter.cs
示例17: ConstructBigPrimeProducts
private static BigInteger[] ConstructBigPrimeProducts(int[] primeProducts)
{
BigInteger[] bpp = new BigInteger[primeProducts.Length];
for (int i = 0; i < bpp.Length; ++i)
{
bpp[i] = BigInteger.ValueOf(primeProducts[i]);
}
return bpp;
}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:9,代码来源:DHParametersHelper.cs
示例18: ElGamalPublicKeyParameters
public ElGamalPublicKeyParameters(
BigInteger y,
ElGamalParameters parameters)
: base(false, parameters)
{
if (y == null)
throw new ArgumentNullException("y");
this.y = y;
}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:10,代码来源:ElGamalPublicKeyParameters.cs
示例19: CalculateMessage
/**
* calculate our initial message.
*/
public BigInteger CalculateMessage()
{
DHKeyPairGenerator dhGen = new DHKeyPairGenerator();
dhGen.Init(new DHKeyGenerationParameters(random, dhParams));
AsymmetricCipherKeyPair dhPair = dhGen.GenerateKeyPair();
this.privateValue = ((DHPrivateKeyParameters)dhPair.Private).X;
return ((DHPublicKeyParameters)dhPair.Public).Y;
}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:13,代码来源:DHAgreement.cs
示例20: ElGamalPrivateKeyParameters
public ElGamalPrivateKeyParameters(
BigInteger x,
ElGamalParameters parameters)
: base(true, parameters)
{
if (x == null)
throw new ArgumentNullException("x");
this.x = x;
}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:10,代码来源:ElGamalPrivateKeyParameters.cs
注:本文中的NBitcoin.BouncyCastle.Math.BigInteger类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论