Tidied up example/static test executables

This commit is contained in:
Leonetienne
2022-05-26 18:24:44 +02:00
parent e7c1e17e2c
commit c0418766d9
20 changed files with 574 additions and 69 deletions

View File

@@ -26,7 +26,7 @@ namespace Leonetienne::GCrypt {
}
// Return the next bit.
return hasher.GetHashsum()[nextBit++];
return hasher.GetHashsum().GetBit(nextBit++);
}
void GPrng::AdvanceBlock() {
@@ -50,8 +50,6 @@ namespace Leonetienne::GCrypt {
// 1) Fetch complete current hashsum (it might have been partially given out already)
// 2) Bitshift it, and matrix-mult it with the seed (that is irreversible)
// That should be a one-way function, and create a new unique block.
// We don't even have to AdvanceBlock(), because we've only given out
// hashsum', not hashsum.
// Performance improvement over the previous method:
// (generating 100.000 blocks):
@@ -65,6 +63,9 @@ namespace Leonetienne::GCrypt {
hashsum.ShiftBitsLeftInplace();
hashsum *= seed;
// Advance the block, so that the following block will be a new block
AdvanceBlock();
// Return our hashsum
return hashsum;
}