Sha256: 55ca4be780b93d21d71247b34fdc1baa9b56dc827c22612a4c49d54723277c3d

Contents?: true

Size: 1016 Bytes

Versions: 1

Compression:

Stored size: 1016 Bytes

Contents

$:.unshift(File.dirname(__FILE__) + "/../lib/")

require 'test/unit'
require 'ezcrypto'
require 'digest/sha1'

class DigestTest < Test::Unit::TestCase

  def setup
  end

  def test_digest
    ["hello","","test"].each do |data|
      assert_equal Digest::SHA1.digest(data)[0..15],EzCrypto::Digester.digest(data)
    end
  end
  
  def test_digest64
    ["hello","","test"].each do |data|
      assert_equal [Digest::SHA1.digest(data)[0..15]].pack('m'),EzCrypto::Digester.digest64(data)
    end    
  end
  
  def test_hexdigest
    ["hello","","test"].each do |data|
      assert_equal Digest::SHA1.hexdigest(data)[0..40],EzCrypto::Digester.hexdigest(data)
    end
  end
  
  def test_generate_key
    key=EzCrypto::Digester.generate_key
    assert 16,key.size
  end
  
  def test_generate_key64
    key=EzCrypto::Digester.generate_key64
    assert 24,key.size
    
  end
  
  def test_generate_hexkey
    key=EzCrypto::Digester.generate_hexkey
    assert 40,key.size
    
  end
  
  def test_get_key
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jamescook-ezcrypto-0.7.4 test/digest_test.rb