MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / Randomize

Method Randomize

src/cryptlib/integer.cpp:1473–1480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1471}
1472
1473void Integer::Randomize(RandomNumberGenerator &rng, unsigned int nbits)
1474{
1475 const unsigned int nbytes = nbits/8 + 1;
1476 SecByteBlock buf(nbytes);
1477 rng.GetBlock(buf, nbytes);
1478 buf[(unsigned int)0] = (byte)Crop(buf[(unsigned int)0], nbits % 8);
1479 Decode(buf, nbytes, UNSIGNED);
1480}
1481
1482void Integer::Randomize(RandomNumberGenerator &rng, const Integer &min, const Integer &max)
1483{

Callers 5

RabinMillerTestFunction · 0.80
ProvablePrimeFunction · 0.80
PrimeAndGeneratorMethod · 0.80
ElGamalSigPrivateKeyMethod · 0.80

Calls 4

CropFunction · 0.85
NextPrimeFunction · 0.85
BitCountMethod · 0.80
GetBlockMethod · 0.45

Tested by

no test coverage detected