comparison mod_auth_joomla/mod_auth_joomla.lua @ 719:5e71e24e33fc

mod_auth_joomla: Joomla hash should be hex-encoded, not raw binary (thanks Anthony).
author Waqas Hussain <waqas20@gmail.com>
date Sat, 23 Jun 2012 00:42:01 +0500
parents 1082856e4612
children 97f6d7c4aaed
comparison
equal deleted inserted replaced
718:a37e4149ccd1 719:5e71e24e33fc
87 end 87 end
88 end 88 end
89 89
90 90
91 local function getCryptedPassword(plaintext, salt) 91 local function getCryptedPassword(plaintext, salt)
92 return md5(plaintext..salt); 92 local salted = plaintext..salt;
93 return md5(salted, true);
93 end 94 end
94 local function joomlaCheckHash(password, hash) 95 local function joomlaCheckHash(password, hash)
95 local crypt, salt = hash:match("^([^:]*):(.*)$"); 96 local crypt, salt = hash:match("^([^:]*):(.*)$");
96 return (crypt or hash) == getCryptedPassword(password, salt or ''); 97 return (crypt or hash) == getCryptedPassword(password, salt or '');
97 end 98 end