Sha256: 8d1e12c7b7c4e1f490913fd23719d815cbe0e544beac8a5515f305091a43b328

Contents?: true

Size: 530 Bytes

Versions: 1

Compression:

Stored size: 530 Bytes

Contents

require 'helper'

def random_string
  Salty.generate_salt
end

class TestSalty < Test::Unit::TestCase
  context "test salt" do
    should "hash equality" do
      100.times do
        str = random_string

        hashed = Salty.hash(str)
        assert Salty.check(str,hashed)
      end
    end

    should "hash inequaliy" do
      100.times do
        str = random_string
        hashed = Salty.hash(str)

        other = random_string
        assert(other == str || (not Salty.check(other,hashed)))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
salty-0.1.0 test/test_salty.rb