Skip to content

Commit 82607b5

Browse files
jefftrudeau29decibel
authored andcommitted
Changes per heartcombo#21
1 parent b04d8c2 commit 82607b5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/devise/encryptable/encryptors/pbkdf2.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ module Encryptors
55
class Pbkdf2 < Base
66
def self.compare(encrypted_password, password, stretches, salt, pepper)
77
value_to_test = self.digest(password, stretches, salt, pepper)
8-
ActiveSupport::SecurityUtils.fixed_length_secure_compare(encrypted_password, value_to_test)
8+
Devise.secure_compare(encrypted_password, value_to_test)
99
end
1010

1111
def self.digest(password, stretches, salt, pepper)
12-
hash = OpenSSL::Digest::SHA512.new
12+
hash = OpenSSL::Digest.new('SHA512').new
1313
OpenSSL::KDF.pbkdf2_hmac(
14-
password,
14+
password.to_s,
1515
salt: "#{[salt].pack('H*')}#{pepper}",
1616
iterations: stretches,
1717
hash: hash,
1818
length: hash.digest_length,
19-
).unpack('H*')[0]
19+
).unpack1('H*')
2020
end
2121
end
2222
end

0 commit comments

Comments
 (0)