More streamlined naming scheme for digestion method of ghash
This commit is contained in:
parent
f246e3a5ef
commit
75c4b0a0d9
@ -11,7 +11,7 @@ using namespace Leonetienne::Eule;
|
|||||||
|
|
||||||
void HashAndVisualize(const Block& b, const std::string filename) {
|
void HashAndVisualize(const Block& b, const std::string filename) {
|
||||||
GHash hasher;
|
GHash hasher;
|
||||||
hasher.DigestBlock(b);
|
hasher.Digest(b);
|
||||||
VisualizeBlock(hasher.GetHashsum(), filename);
|
VisualizeBlock(hasher.GetHashsum(), filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ namespace Leonetienne::GCrypt {
|
|||||||
//! WARNING: If you compute hashes using this digestive method,
|
//! WARNING: If you compute hashes using this digestive method,
|
||||||
//! you REALLY REALLY should add a trailing block just containing the cleartext size!
|
//! you REALLY REALLY should add a trailing block just containing the cleartext size!
|
||||||
//! You MOST LIKELY just want to use the wrapper function GHash::CalculateHashsum(Flexblock const&) instead!
|
//! You MOST LIKELY just want to use the wrapper function GHash::CalculateHashsum(Flexblock const&) instead!
|
||||||
void DigestBlock(const Block& data);
|
void Digest(const Block& data);
|
||||||
|
|
||||||
//! Will return the current hashsum
|
//! Will return the current hashsum
|
||||||
const Block& GetHashsum() const;
|
const Block& GetHashsum() const;
|
||||||
|
@ -24,7 +24,7 @@ namespace Leonetienne::GCrypt {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHash::DigestBlock(const Block& data) {
|
void GHash::Digest(const Block& data) {
|
||||||
// Set the cipher key to the current data to be hashed
|
// Set the cipher key to the current data to be hashed
|
||||||
cipher.SetKey(data);
|
cipher.SetKey(data);
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ namespace Leonetienne::GCrypt {
|
|||||||
|
|
||||||
// Digest all blocks
|
// Digest all blocks
|
||||||
for (const Block& block : data) {
|
for (const Block& block : data) {
|
||||||
hasher.DigestBlock(block);
|
hasher.Digest(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add an additional block, containing the length of the input
|
// Add an additional block, containing the length of the input
|
||||||
@ -75,7 +75,7 @@ namespace Leonetienne::GCrypt {
|
|||||||
lengthBlock.FromTextString(ss.str());
|
lengthBlock.FromTextString(ss.str());
|
||||||
|
|
||||||
// Digest the length block
|
// Digest the length block
|
||||||
hasher.DigestBlock(lengthBlock);
|
hasher.Digest(lengthBlock);
|
||||||
|
|
||||||
// Return the total hashsum
|
// Return the total hashsum
|
||||||
return hasher.GetHashsum();
|
return hasher.GetHashsum();
|
||||||
|
@ -5,7 +5,7 @@ namespace Leonetienne::GCrypt {
|
|||||||
|
|
||||||
GPrng::GPrng(const Block& seed) {
|
GPrng::GPrng(const Block& seed) {
|
||||||
this->seed = seed;
|
this->seed = seed;
|
||||||
hasher.DigestBlock(seed);
|
hasher.Digest(seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
GPrng::GPrng() {
|
GPrng::GPrng() {
|
||||||
@ -14,7 +14,7 @@ namespace Leonetienne::GCrypt {
|
|||||||
void GPrng::Seed(const Block& seed) {
|
void GPrng::Seed(const Block& seed) {
|
||||||
hasher = GHash();
|
hasher = GHash();
|
||||||
this->seed = seed;
|
this->seed = seed;
|
||||||
hasher.DigestBlock(seed);
|
hasher.Digest(seed);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ namespace Leonetienne::GCrypt {
|
|||||||
// state of the hash function, unless the seed is known.
|
// state of the hash function, unless the seed is known.
|
||||||
|
|
||||||
// Advance the block (Add the current hashsum XOR seed to the hasher)
|
// Advance the block (Add the current hashsum XOR seed to the hasher)
|
||||||
hasher.DigestBlock(Block(hasher.GetHashsum() ^ seed));
|
hasher.Digest(Block(hasher.GetHashsum() ^ seed));
|
||||||
|
|
||||||
// Reset the pointer
|
// Reset the pointer
|
||||||
nextBit = 0;
|
nextBit = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user