MCPcopy Create free account
hub / github.com/assaultcube/AC / entropy_get

Function entropy_get

source/src/crypto.cpp:450–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448}
449
450void entropy_get(uchar *buf, int len)
451{
452 ASSERT(len <= ENTPOOLSIZE);
453 uchar *tempbuf = new uchar[len + SHA512SIZE];
454 memcpy(tempbuf, entpool, len);
455 memcpy(entpool + ENTPOOLSIZE, entpool, 128);
456 sha512(tempbuf, entpool, ENTPOOLSIZE);
457 loopi(len) sha512_compress((uint64_t*)(tempbuf + (i & ~7)), entpool + rnd(ENTPOOLSIZE / 8) * 8);
458 memcpy(buf, tempbuf, len);
459 delete[] tempbuf;
460}
461
462#ifndef STANDALONE
463/////////////////////////////////////////////// key derivation function ////////////////////////////////////////////////////////////////////////

Callers 5

parsemessagesFunction · 0.85
entropy_initFunction · 0.85
ed25519speedtestFunction · 0.85
authsetupFunction · 0.85
authkey_Function · 0.85

Calls 3

sha512Function · 0.85
sha512_compressFunction · 0.85
loopiFunction · 0.70

Tested by

no test coverage detected