Permalink
Browse files

Use proper Ruby SHA1

 * Ruby 1.8.[67] and 1.9's SHA1 is in 'digest/sha1'
  • Loading branch information...
1 parent 4fafdd5 commit afe6567a907e4693f1cfb915efb3b76805daa697 emiel committed Feb 21, 2009
Showing with 2 additions and 2 deletions.
  1. +2 −2 test/test_ldif.rb
View
@@ -3,7 +3,7 @@
require 'common'
require 'net/ldif'
-require 'sha1'
+require 'digest/sha1'
require 'base64'
class TestLdif < Test::Unit::TestCase
@@ -24,7 +24,7 @@ def test_ldif_with_comments
def test_ldif_with_password
psw = "goldbricks"
- hashed_psw = "{SHA}" + Base64::encode64( SHA1.new(psw).digest ).chomp
+ hashed_psw = "{SHA}" + Base64::encode64(Digest::SHA1.digest(psw)).chomp
ldif_encoded = Base64::encode64( hashed_psw ).chomp
ds = Net::LDAP::Dataset::read_ldif( StringIO.new( "dn: Goldbrick\r\nuserPassword:: #{ldif_encoded}\r\n\r\n" ))

0 comments on commit afe6567

Please sign in to comment.