Skip to content

Commit 94d2d6a

Browse files
author
Tatsuya Sato
committed
Remove the dangling srand
1 parent cb27e21 commit 94d2d6a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/net/ldap/password.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ class << self
2323
def generate(type, str)
2424
case type
2525
when :md5
26-
attribute_value = '{MD5}' + Base64.encode64(Digest::MD5.digest(str)).chomp!
26+
attribute_value = '{MD5}' + Base64.encode64(Digest::MD5.digest(str)).chomp!
2727
when :sha
28-
attribute_value = '{SHA}' + Base64.encode64(Digest::SHA1.digest(str)).chomp!
28+
attribute_value = '{SHA}' + Base64.encode64(Digest::SHA1.digest(str)).chomp!
2929
when :ssha
30-
srand; salt = SecureRandom.random_bytes(16)
30+
salt = SecureRandom.random_bytes(16)
3131
attribute_value = '{SSHA}' + Base64.encode64(Digest::SHA1.digest(str + salt) + salt).chomp!
3232
else
3333
raise Net::LDAP::HashTypeUnsupportedError, "Unsupported password-hash type (#{type})"

0 commit comments

Comments
 (0)