chore: direct braced string initialization
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2021-11-20 21:20:38 +01:00
parent 4cea227cdd
commit bcd33c2f33
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
2 changed files with 6 additions and 5 deletions

@ -39,7 +39,7 @@ namespace fortuna {
prng.GenerateBlock(ctr,sizeof(ctr)); prng.GenerateBlock(ctr,sizeof(ctr));
// William Shakespeare, Romeo and Juliet // William Shakespeare, Romeo and Juliet
std::string plain = "Oh, I am fortune's fool!"; std::string plain{"Oh, I am fortune's fool!"};
std::string cipher, encoded_c, decrypted; std::string cipher, encoded_c, decrypted;
try { try {

@ -54,8 +54,9 @@ auto Generator::do_sha(const std::string& k_n_s) -> std::string {
CryptoPP::SHA3_256 sha3_256; CryptoPP::SHA3_256 sha3_256;
digest.erase(); digest.erase();
std::string to_compare = const std::string to_compare{
"8eccfbbbc9df48b4272e6237ce45aad8fbe59629b4963c4dcda5716e61bb34e1"; "8eccfbbbc9df48b4272e6237ce45aad8fbe59629b4963c4dcda5716e61bb34e1"
};
CryptoPP::StringSource bar(k_n_s,true, CryptoPP::StringSource bar(k_n_s,true,
new HashFilter(sha3_256,new HexEncoder(new StringSink(digest),false)) new HashFilter(sha3_256,new HexEncoder(new StringSink(digest),false))
@ -81,7 +82,7 @@ auto Generator::do_crypto() -> std::string {
auto Generator::generate_blocks(unsigned int k_blocks) -> std::string { auto Generator::generate_blocks(unsigned int k_blocks) -> std::string {
assert ((G.ctr!=0) && "Counter is not 0, generator has been seeded"); assert ((G.ctr!=0) && "Counter is not 0, generator has been seeded");
std::string r = ""; std::string r{""};
for (int i = 0; i < k_blocks; ++i) { for (int i = 0; i < k_blocks; ++i) {
r += do_crypto(); r += do_crypto();
++G.ctr; ++G.ctr;
@ -90,7 +91,7 @@ auto Generator::generate_blocks(unsigned int k_blocks) -> std::string {
} }
auto Generator::generate_random_data(uint n) -> std::string { auto Generator::generate_random_data(uint n) -> std::string {
std::string r = ""; std::string r{""};
if (n < 0){ if (n < 0){
/* this should not be possible */ /* this should not be possible */
fmt::print("[*] error: n cannot be < 0\n"); fmt::print("[*] error: n cannot be < 0\n");