X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/970e1a99d7dce64f0631e88c5b9f060fb48d75fe..46e3d846747a8ed50b2fd29d1e162432fca38e7d:/lib/password_hash.rb diff --git a/lib/password_hash.rb b/lib/password_hash.rb index c65df2c4f..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 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 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