X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/44e778aedd91a84582cbbef4ffc6e9912d001d66..6b8c58d2eb7d26d2cae23c1f30390f0321d558a2:/lib/password_hash.rb 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