Merge pull request #2 from Der-Jan/master

Added wbblite doublesalted
This commit is contained in:
discoursehosting 2015-12-22 16:17:48 +01:00
commit 0537834c93

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