Sha256: 30858b4f912b4b655a23268405c90cc276898f730e0285271b80cb8c1028bdb4

Contents?: true

Size: 1.14 KB

Versions: 6

Compression:

Stored size: 1.14 KB

Contents

require 'test/unit'

require 'stringio'

require 'samba/encrypt'

class SambaEncryptTest < Test::Unit::TestCase
  def test_lm_hash
    assert_equal("E52CAC67419A9A224A3B108F3FA6CB6D",
                 Samba::Encrypt.lm_hash("password"))
    assert_equal("E52CAC67419A9A224A3B108F3FA6CB6D",
                 Samba::Encrypt.lm_hash("paSSWOrd"))
    assert_equal("E0C510199CC66ABDE0C510199CC66ABD",
                 Samba::Encrypt.lm_hash("abcdefgabcdefg"))
    assert_equal("FF3750BCC2B22412C2265B23734E0DAC",
                 Samba::Encrypt.lm_hash("SecREt01"))
    begin
      stderr = $stderr
      $stderr = StringIO.new
      assert_equal("E0C510199CC66ABDE0C510199CC66ABD",
                   Samba::Encrypt.lm_hash("abcdefgabcdefg" + "X"))
      assert_equal("E0C510199CC66ABDE0C510199CC66ABD",
                   Samba::Encrypt.lm_hash("abcdefgabcdefg" + "X" * 100))
      assert_equal("password is truncated to 14 characters\n" * 2,
                   $stderr.string)
    ensure
      $stderr = stderr
    end
  end

  def test_ntlm_hash
    assert_equal("8846F7EAEE8FB117AD06BDD830B7586C",
                 Samba::Encrypt.ntlm_hash("password"))
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
activesambaldap-0.1.0 test/test_samba_encrypt.rb
activesambaldap-0.0.9 test/test_samba_encrypt.rb
activesambaldap-0.0.8 test/test_samba_encrypt.rb
ActiveSambaLdap-0.0.7 test/test_samba_encrypt.rb
activesambaldap-0.0.7 test/test_samba_encrypt.rb
activesambaldap-0.0.6 test/test_samba_encrypt.rb