chore(generator): comments clean-up
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-01-08 06:34:30 +01:00
parent 592d3aac47
commit 408d783c37
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

View File

@ -37,7 +37,7 @@ void Generator::initialize_generator(){
fmt::print(stderr, "{}\n", e.what());
exit(1);
}
};
}
auto Generator::get_state() const -> G_state {
return G;
@ -47,9 +47,6 @@ auto Generator::reseed(const std::string& s) -> void {
// ref: https://www.cryptopp.com/wiki/SecBlock
std::string da_key(reinterpret_cast<const char*>(&G.k[0]),
G.k.SizeInBytes() * 8); // we need the size in bits
// fmt::print("s -> {}\n", s); // debugging
// fmt::print("da_key -> {}\n", da_key); // debugging
// fmt::print("concat \"da_key + s\" -> {}\n", to_be_hashed); // debugging
try {
std::lock_guard<std::mutex> lg(mtx);
@ -89,8 +86,6 @@ auto Generator::do_crypto() -> std::string {
std::memmove(&ctr, &G.ctr, ctr_length);
try {
// fmt::print("plain text: {}\n", plain);
CTR_Mode<Serpent>::Encryption e;
e.SetKeyWithIV(G.k,G.k.size(),ctr);
@ -116,20 +111,17 @@ auto Generator::do_crypto() -> std::string {
new StringSink(encoded_c)
) // HexEncoder
); // StringSource
// fmt::print("cipher text: {}\n", encoded_c);
return encoded_c;
}
auto Generator::generate_blocks(unsigned int k_blocks) -> std::string {
assert ((G.ctr!=0) && "Counter is not 0, generator has been seeded");
// fmt::print("k_blocks -> {}\n", k_blocks); // debugging
std::string r{""};
for (int i = 0; i < k_blocks; ++i) {
r += do_crypto();
++G.ctr;
}
// fmt::print("r from generate_blocks -> {}\n", r); // debugging
return r;
}