本文整理汇总了Java中org.bouncycastle.crypto.prng.drbg.SP80090DRBG类的典型用法代码示例。如果您正苦于以下问题:Java SP80090DRBG类的具体用法?Java SP80090DRBG怎么用?Java SP80090DRBG使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SP80090DRBG类属于org.bouncycastle.crypto.prng.drbg包,在下文中一共展示了SP80090DRBG类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: nextInt
import org.bouncycastle.crypto.prng.drbg.SP80090DRBG; //导入依赖的package包/类
private int nextInt(SP80090DRBG drbg, int range)
{
if ((range & -range) == range) // i.e., range is a power of 2
{
return (int)((range * (long)makePositiveInt(drbg)) >> 31);
}
int bits, val;
do
{
bits = makePositiveInt(drbg);
val = bits % range;
}
while (bits - val + (range - 1) < 0);
return val;
}
开发者ID:cwgit,项目名称:ximix,代码行数:18,代码来源:SeededChallenger.java
示例2: buildBitSet
import org.bouncycastle.crypto.prng.drbg.SP80090DRBG; //导入依赖的package包/类
private BitSet buildBitSet(int size, SP80090DRBG drbg)
{
BitSet bitSet = new BitSet(size);
int nBits = size / 2;
int upper = size - 1;
int lower = 0;
for (int i = 0; i != nBits; i++)
{
int nIndex = nextInt(drbg, upper - lower + 1) + lower;
if (bitSet.get(nIndex))
{
if ((nIndex & 1) != 0)
{
while (bitSet.get(upper))
{
upper--;
}
nIndex = upper--;
}
else
{
while (bitSet.get(lower))
{
lower++;
}
nIndex = lower++;
}
}
bitSet.set(nIndex);
}
return bitSet;
}
开发者ID:cwgit,项目名称:ximix,代码行数:40,代码来源:SeededChallenger.java
示例3: makePositiveInt
import org.bouncycastle.crypto.prng.drbg.SP80090DRBG; //导入依赖的package包/类
private int makePositiveInt(SP80090DRBG drbg)
{
byte[] bytes = new byte[4];
drbg.generate(bytes, null, false);
return ((bytes[0] & 0x7f) << 24) | ((bytes[1] & 0xff) << 16) | ((bytes[2] & 0xff) << 8) | (bytes[3] & 0xff);
}
开发者ID:cwgit,项目名称:ximix,代码行数:9,代码来源:SeededChallenger.java
示例4: get
import org.bouncycastle.crypto.prng.drbg.SP80090DRBG; //导入依赖的package包/类
public SP80090DRBG get(EntropySource entropySource)
{
return new HashSP800DRBG(digest, securityStrength, entropySource, personalizationString, nonce);
}
开发者ID:Appdome,项目名称:ipack,代码行数:5,代码来源:SP800SecureRandomBuilder.java
注:本文中的org.bouncycastle.crypto.prng.drbg.SP80090DRBG类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论