Support IPB algorithm

This commit is contained in:
DiscourseHosting 2015-07-17 12:42:38 -04:00
parent 1e6bd8f9bc
commit e6a1708881

View File

@ -103,6 +103,7 @@ after_initialize do
def self.check_all(password, crypted_pass)
AlternativePassword::check_vbulletin(password, crypted_pass) ||
AlternativePassword::check_ipb(password, crypted_pass) ||
AlternativePassword::check_md5(password, crypted_pass) ||
AlternativePassword::check_wordpress(password, crypted_pass) ||
AlternativePassword::check_bcrypt(password, crypted_pass) ||
@ -126,6 +127,11 @@ after_initialize do
crypted_pass == Digest::MD5.hexdigest(password)
end
def self.check_ipb(password, crypted_pass)
salt, hash = crypted_pass.split(':', 2)
!salt.nil? && hash == Digest::MD5.hexdigest(Digest::MD5.hexdigest(salt) + Digest::MD5.hexdigest(password))
end
def self.check_wordpress(password, crypted_pass)
hasher = WordpressHash.new(8)
hasher.check(password, crypted_pass)