From d15b8ee9494e02f8e685fb0ef8443c9654b8bd67 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 8 Aug 2025 13:14:14 +0100 Subject: [PATCH] Remove some dead code from enc_sha256. --- modules/encryption/enc_sha256.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/modules/encryption/enc_sha256.cpp b/modules/encryption/enc_sha256.cpp index 9af5569f5..17dc5dee1 100644 --- a/modules/encryption/enc_sha256.cpp +++ b/modules/encryption/enc_sha256.cpp @@ -17,14 +17,6 @@ class ESHA256 final { private: unsigned iv[8]; - bool use_iv; - - /* initializes the IV with a new random value */ - void NewRandomIV() - { - for (auto &ivsegment : iv) - ivsegment = static_cast(Anope::RandomNumber()); - } /* returns the IV as base64-encrypted string */ Anope::string GetIVString() @@ -50,11 +42,6 @@ private: Anope::string EncryptInternal(const Anope::string &src) { - if (!use_iv) - NewRandomIV(); - else - use_iv = false; - sha256_ctx ctx; sha256_init(&ctx); for (size_t i = 0; i < 8; ++i) @@ -71,7 +58,6 @@ public: ESHA256(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DEPRECATED | ENCRYPTION | VENDOR) { - use_iv = false; if (ModuleManager::FindFirstOf(ENCRYPTION) == this) throw ModuleException("enc_sha256 is deprecated and can not be used as a primary encryption method"); } @@ -92,7 +78,6 @@ public: return; GetIVFromPass(nc->pass); - use_iv = true; auto enc = EncryptInternal(req->GetPassword()); if (nc->pass.equals_cs(enc)) {