Class: DigestTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/extensions/ezcrypto/ext/test/digest_test.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



10
11
# File 'lib/extensions/ezcrypto/ext/test/digest_test.rb', line 10

def setup
end

#test_digestObject



13
14
15
16
17
# File 'lib/extensions/ezcrypto/ext/test/digest_test.rb', line 13

def test_digest
  ["hello","","test"].each do |data|
    assert_equal Digest::SHA1.digest(data)[0..15],EzCrypto::Digester.digest(data)
  end
end

#test_digest64Object



19
20
21
22
23
# File 'lib/extensions/ezcrypto/ext/test/digest_test.rb', line 19

def test_digest64
  ["hello","","test"].each do |data|
    assert_equal Base64.encode64(Digest::SHA1.digest(data)[0..15]),EzCrypto::Digester.digest64(data)
  end    
end

#test_generate_hexkeyObject



42
43
44
45
46
# File 'lib/extensions/ezcrypto/ext/test/digest_test.rb', line 42

def test_generate_hexkey
  key=EzCrypto::Digester.generate_hexkey
  assert 40,key.size
  
end

#test_generate_keyObject



31
32
33
34
# File 'lib/extensions/ezcrypto/ext/test/digest_test.rb', line 31

def test_generate_key
  key=EzCrypto::Digester.generate_key
  assert 16,key.size
end

#test_generate_key64Object



36
37
38
39
40
# File 'lib/extensions/ezcrypto/ext/test/digest_test.rb', line 36

def test_generate_key64
  key=EzCrypto::Digester.generate_key64
  assert 24,key.size
  
end

#test_get_keyObject



48
49
50
# File 'lib/extensions/ezcrypto/ext/test/digest_test.rb', line 48

def test_get_key
  
end

#test_hexdigestObject



25
26
27
28
29
# File 'lib/extensions/ezcrypto/ext/test/digest_test.rb', line 25

def test_hexdigest
  ["hello","","test"].each do |data|
    assert_equal Digest::SHA1.hexdigest(data)[0..40],EzCrypto::Digester.hexdigest(data)
  end
end