X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/f4c761a0ed2134fcaf59514a7e1637cf8f6dc05b..d6af4450d1ea3599cdce6921138155f73e154816:/lib/password_hash.rb diff --git a/lib/password_hash.rb b/lib/password_hash.rb index 5bafe6dda..9f77fdc0d 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 /!/.match?(salt) + elsif salt.match?(/!/) 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 /!/.match?(salt) + elsif salt.match?(/!/) 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