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

Method GetLong

src/cryptlib/cryptlib.cpp:18–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}
17
18word32 RandomNumberGenerator::GetLong(word32 min, word32 max)
19{
20 word32 range = max-min;
21 const int maxBytes = BytePrecision(range);
22 const int maxBits = BitPrecision(range);
23
24 word32 value;
25
26 do
27 {
28 value = 0;
29 for (int i=0; i<maxBytes; i++)
30 value = (value << 8) | GetByte();
31
32 value = Crop(value, maxBits);
33 } while (value > range);
34
35 return value+min;
36}
37
38void StreamCipher::ProcessString(byte *outString, const byte *inString, unsigned int length)
39{

Callers 2

ShuffleFunction · 0.80
ProvablePrimeFunction · 0.80

Calls 3

BytePrecisionFunction · 0.85
BitPrecisionFunction · 0.85
CropFunction · 0.85

Tested by

no test coverage detected