From 348b921795fc87397704cd177344339c2558f1a8 Mon Sep 17 00:00:00 2001 From: surtur Date: Thu, 3 Feb 2022 02:41:47 +0100 Subject: [PATCH] generator: add const qualifier to vars where sound --- generator.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/generator.cpp b/generator.cpp index 41c0f97..8ef7a30 100644 --- a/generator.cpp +++ b/generator.cpp @@ -167,7 +167,7 @@ auto Generator::generate_random_data(const uint64_t& n) -> std::string { /* do magic to compute r * r ← first-n-bytes(GenerateBlocks(G, ceil(n/16) )) */ - unsigned int how_many( + const unsigned int how_many( static_cast(std::ceil(static_cast(n) / 16))); std::string rr{generate_blocks(how_many)}; @@ -181,12 +181,11 @@ auto Generator::generate_random_data(const uint64_t& n) -> std::string { /* re-key */ try { - std::string nu_G_k{generate_blocks(2)}; + const std::string nu_G_k{generate_blocks(2)}; /* clear out the old key and set a new one */ std::memset(G.k, 0x00, G.k_length); std::memmove(G.k, nu_G_k.c_str(), G.k_length); - nu_G_k.clear(); } catch (std::exception& e) { fmt::print(stderr, "{}", e.what());