X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/44e778aedd91a84582cbbef4ffc6e9912d001d66..033c3b28b3b2708634f3015449d0c2ed222e26d6:/lib/password_hash.rb?ds=sidebyside diff --git a/lib/password_hash.rb b/lib/password_hash.rb index c65df2c4f..afea82c11 100644 --- a/lib/password_hash.rb +++ b/lib/password_hash.rb @@ -18,7 +18,7 @@ module PasswordHash def self.check(hash, salt, candidate) if salt.nil? candidate = Digest::MD5.hexdigest(candidate) - elsif salt =~ /!/ + elsif salt.include?("!") algorithm, iterations, salt = salt.split("!") size = Base64.strict_decode64(hash).length candidate = self.hash(candidate, salt, iterations.to_i, size, algorithm) @@ -32,7 +32,7 @@ module PasswordHash def self.upgrade?(hash, salt) if salt.nil? return true - elsif salt =~ /!/ + elsif salt.include?("!") algorithm, iterations, salt = salt.split("!") return true if Base64.strict_decode64(salt).length != SALT_BYTE_SIZE return true if Base64.strict_decode64(hash).length != HASH_BYTE_SIZE