diff mod_auth_phpbb3/mod_auth_phpbb3.lua @ 6346:c400892603ce

Updating phpbb3 authentication module for argon2 password support.
author Ganiman <ganiman@ganiman.com>
date Tue, 28 Oct 2025 16:29:47 -0400
parents 28d99ffa3c06
children
line wrap: on
line diff
--- a/mod_auth_phpbb3/mod_auth_phpbb3.lua	Mon Oct 27 12:05:07 2025 +0100
+++ b/mod_auth_phpbb3/mod_auth_phpbb3.lua	Tue Oct 28 16:29:47 2025 -0400
@@ -11,6 +11,7 @@
 local md5 = require "util.hashes".md5;
 local uuid_gen = require "util.uuid".generate;
 local have_bcrypt, bcrypt = pcall(require, "bcrypt"); -- available from luarocks
+local argon2 = require("argon2")
 
 local connection;
 local params = module:get_option("sql");
@@ -179,6 +180,7 @@
 	if #hash == 32 then return hash == md5(password, true); end -- legacy PHPBB2 hash
 	if #hash == 34 then return hashCryptPrivate(password, hash) == hash; end
 	if #hash == 60 and have_bcrypt then return bcrypt.verify(password, hash); end
+	if #hash == 97 then return argon2.verify(hash, password); end
 	module:log("error", "Unsupported hash: %s", hash);
 	return false;
 end