summaryrefslogtreecommitdiff
path: root/modules/encryption
diff options
context:
space:
mode:
Diffstat (limited to 'modules/encryption')
-rw-r--r--modules/encryption/enc_bcrypt.cpp4
-rw-r--r--modules/encryption/enc_sha256.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/modules/encryption/enc_bcrypt.cpp b/modules/encryption/enc_bcrypt.cpp
index 7eec04ad2..94c6fc164 100644
--- a/modules/encryption/enc_bcrypt.cpp
+++ b/modules/encryption/enc_bcrypt.cpp
@@ -20,8 +20,8 @@ class EBCRYPT : public Module
Anope::string Salt()
{
char entropy[16];
- for (unsigned int i = 0; i < sizeof(entropy); i++)
- entropy[i] = static_cast<char>(rand() % 0xFF);
+ for (auto &chr : entropy)
+ chr = static_cast<char>(rand() % 0xFF);
char salt[32];
if (!_crypt_gensalt_blowfish_rn("$2a$", rounds, entropy, sizeof(entropy), salt, sizeof(salt)))
diff --git a/modules/encryption/enc_sha256.cpp b/modules/encryption/enc_sha256.cpp
index 878598248..d5cebcb74 100644
--- a/modules/encryption/enc_sha256.cpp
+++ b/modules/encryption/enc_sha256.cpp
@@ -245,8 +245,8 @@ class ESHA256 : public Module
/* initializes the IV with a new random value */
void NewRandomIV()
{
- for (int i = 0; i < 8; ++i)
- iv[i] = static_cast<uint32_t>(rand());
+ for (auto &ivsegment : iv)
+ ivsegment = static_cast<uint32_t>(rand());
}
/* returns the IV as base64-encrypted string */