Skip to content

Commit afe6567

Browse files
author
emiel
committed
Use proper Ruby SHA1
* Ruby 1.8.[67] and 1.9's SHA1 is in 'digest/sha1'
1 parent 4fafdd5 commit afe6567

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/test_ldif.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require 'common'
44

55
require 'net/ldif'
6-
require 'sha1'
6+
require 'digest/sha1'
77
require 'base64'
88

99
class TestLdif < Test::Unit::TestCase
@@ -24,7 +24,7 @@ def test_ldif_with_comments
2424

2525
def test_ldif_with_password
2626
psw = "goldbricks"
27-
hashed_psw = "{SHA}" + Base64::encode64( SHA1.new(psw).digest ).chomp
27+
hashed_psw = "{SHA}" + Base64::encode64(Digest::SHA1.digest(psw)).chomp
2828

2929
ldif_encoded = Base64::encode64( hashed_psw ).chomp
3030
ds = Net::LDAP::Dataset::read_ldif( StringIO.new( "dn: Goldbrick\r\nuserPassword:: #{ldif_encoded}\r\n\r\n" ))

0 commit comments

Comments
 (0)