MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / TimeRandomize

Function TimeRandomize

Libraries/unrar/crypt.cpp:96–107  ·  view source on GitHub ↗

Use the current system time to additionally randomize data.

Source from the content-addressed store, hash-verified

94
95// Use the current system time to additionally randomize data.
96static void TimeRandomize(byte *RndBuf,size_t BufSize)
97{
98 static uint Count=0;
99 RarTime CurTime;
100 CurTime.SetCurrentTime();
101 uint64 Random=CurTime.GetWin()+clock();
102 for (size_t I=0;I<BufSize;I++)
103 {
104 byte RndByte = byte (Random >> ( (I & 7) * 8 ));
105 RndBuf[I]=byte( (RndByte ^ I) + Count++);
106 }
107}
108
109
110

Callers 1

GetRndFunction · 0.85

Calls 2

SetCurrentTimeMethod · 0.80
GetWinMethod · 0.80

Tested by

no test coverage detected