Sha256: e99e4355855f36f53c89abfce7e37a8c9a2b5c7da4120d5bf1b7f12b7019f852

Contents?: true

Size: 842 Bytes

Versions: 14

Compression:

Stored size: 842 Bytes

Contents

# Test facets/crypt.rb

require "facets/crypt.rb"
require "test/unit"

class CryptTest < Test::Unit::TestCase

  def array_test(arr, algo)
    arr.each do |password, hash|
      assert(Crypt.check(password, hash, algo))
    end
  end

  def test_md5
    a = [ [' ', '$1$yiiZbNIH$YiCsHZjcTkYd31wkgW8JF.'],
      ['pass', '$1$YeNsbWdH$wvOF8JdqsoiLix754LTW90'],
      ['____fifteen____', '$1$s9lUWACI$Kk1jtIVVdmT01p0z3b/hw1'],
      ['____sixteen_____', '$1$dL3xbVZI$kkgqhCanLdxODGq14g/tW1'],
      ['____seventeen____', '$1$NaH5na7J$j7y8Iss0hcRbu3kzoJs5V.'],
      ['__________thirty-three___________', '$1$HO7Q6vzJ$yGwp2wbL5D7eOVzOmxpsy.'],
      ['apache', '$apr1$J.w5a/..$IW9y6DR0oO/ADuhlMF5/X1']
    ]
    array_test(a, :md5)
  end

  def test_bad_algo
    assert_raise(ArgumentError) do
      Crypt.crypt("qsdf", :qsdf)
    end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
facets-2.6.0 test/more/test_crypt.rb
facets-2.1.3 test/unit/test_crypt.rb
facets-2.2.0 test/unit/test_crypt.rb
facets-2.4.0 test/test_crypt.rb
facets-2.2.1 test/unit/test_crypt.rb
facets-2.3.0 test/more/test_crypt.rb
facets-2.4.1 test/test_crypt.rb
facets-2.4.2 test/more/test_crypt.rb
facets-2.4.3 test/more/test_crypt.rb
facets-2.4.4 test/more/test_crypt.rb
facets-2.4.5 test/more/test_crypt.rb
facets-2.5.0 test/more/test_crypt.rb
facets-2.5.1 test/more/test_crypt.rb
facets-2.5.2 test/more/test_crypt.rb