Use Xorcist.xor! instead of refinements since Ruby 3.2+ removes Refinment-include (#15694)

This commit is contained in:
Noah Gibbs 2022-02-03 05:19:30 +00:00 committed by GitHub
parent 7d5d2bf13e
commit c666094380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,11 +5,8 @@
require 'openssl'
require 'xorcist'
require 'xorcist/refinements'
class Pbkdf2
using Xorcist::Refinements
def self.hash_password(password, salt, iterations, algorithm = "sha256")
h = OpenSSL::Digest.new(algorithm)
@ -18,7 +15,7 @@ class Pbkdf2
2.upto(iterations) do
u = prf(h, password, u)
ret.xor!(u)
Xorcist.xor!(ret, u)
end
ret.bytes.map { |b| ("0" + b.to_s(16))[-2..-1] }.join("")