summaryrefslogtreecommitdiff
path: root/modules/database/db_atheme.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-03-10 14:50:56 +0000
committerSadie Powell <sadie@witchery.services>2024-03-10 15:09:38 +0000
commit9a8cac060d60aee638e368e96afb46967d6d8190 (patch)
tree32365ea7ebb3e255907e352fcf867877ab9cd6a9 /modules/database/db_atheme.cpp
parent0353338436141cd27cebd776cbc74e568e801ffe (diff)
Add support for encrypting passwords with the Argon2 algorithm.
Closes #369.
Diffstat (limited to 'modules/database/db_atheme.cpp')
-rw-r--r--modules/database/db_atheme.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/database/db_atheme.cpp b/modules/database/db_atheme.cpp
index d3877b625..5871605a8 100644
--- a/modules/database/db_atheme.cpp
+++ b/modules/database/db_atheme.cpp
@@ -416,7 +416,7 @@ private:
// some of them currently.
//
// anope-enc-sha256 Converted to enc_sha256
- // argon2 NO
+ // argon2 Converted to enc_argon2
// base64 Converted to the first encryption algorithm
// bcrypt Converted to enc_bcrypt
// crypt3-des NO
@@ -440,6 +440,15 @@ private:
nc->pass = "sha256:" + Anope::Hex(pass) + ":" + Anope::Hex(iv);
}
+ else if (pass.compare(0, 9, "$argon2d$", 9) == 0)
+ nc->pass = "argon2d:" + pass;
+
+ else if (pass.compare(0, 9, "$argon2i$", 9) == 0)
+ nc->pass = "argon2i:" + pass;
+
+ else if (pass.compare(0, 10, "$argon2id$", 10) == 0)
+ nc->pass = "argon2id:" + pass;
+
else if (pass.compare(0, 8, "$base64$", 8) == 0)
{
Anope::string rawpass;