Added wbblite doublesalted

This commit is contained in:
Der-Jan 2015-12-19 12:39:15 +00:00
parent 2ee8561012
commit d740c00c65
1 changed files with 10 additions and 2 deletions

View File

@ -12,6 +12,7 @@
# for Phorum #{password} md5(pass)
# for Wordpress #{password} phpass(8).crypt(pass)
# for SMF #{username}:#{password} sha1(user+pass)
# for WBBlite #{salt}:#{hash} sha1(salt+sha1(salt+sha1(pass)))
gem 'bcrypt', '3.1.3'
@ -109,7 +110,8 @@ after_initialize do
AlternativePassword::check_md5(password, crypted_pass) ||
AlternativePassword::check_wordpress(password, crypted_pass) ||
AlternativePassword::check_bcrypt(password, crypted_pass) ||
AlternativePassword::check_sha256(password, crypted_pass)
AlternativePassword::check_sha256(password, crypted_pass) ||
AlternativePassword::check_wbblite(password, crypted_pass)
end
def self.check_bcrypt(password, crypted_pass)
@ -150,7 +152,13 @@ after_initialize do
sha256 = Digest::SHA256.new
sha256.update password
crypted_pass == sha256.hexdigest
end
end
def self.check_wbblite(password, crypted_pass)
salt, hash = crypted_pass.split(':', 2)
sha1 = Digest::SHA1.hexdigest(salt + Digest::SHA1.hexdigest(salt + Digest::SHA1.hexdigest(password)))
hash == sha1
end
end
class ::User