Class: TraditionalDecrypterTest

Inherits:
MiniTest::Test
  • Object
show all
Defined in:
lib/hotplate/gems/rubyzip-1.1.7/test/crypto/traditional_encryption_test.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



50
51
52
# File 'lib/hotplate/gems/rubyzip-1.1.7/test/crypto/traditional_encryption_test.rb', line 50

def setup
  @decrypter = ::Zip::TraditionalDecrypter.new('password')
end

#test_decryptObject



62
63
64
65
66
67
# File 'lib/hotplate/gems/rubyzip-1.1.7/test/crypto/traditional_encryption_test.rb', line 62

def test_decrypt
  @decrypter.reset!([239, 57, 234, 154, 246, 80, 83, 221, 74, 200, 121, 91].pack("C*"))
  [100, 218, 7, 114, 226, 82, 62, 93, 224, 62].map(&:chr).each do |c|
    assert_equal 'a', @decrypter.decrypt(c)
  end
end

#test_gp_flagsObject



58
59
60
# File 'lib/hotplate/gems/rubyzip-1.1.7/test/crypto/traditional_encryption_test.rb', line 58

def test_gp_flags
  assert_equal 9, @decrypter.gp_flags
end

#test_header_bytesizeObject



54
55
56
# File 'lib/hotplate/gems/rubyzip-1.1.7/test/crypto/traditional_encryption_test.rb', line 54

def test_header_bytesize
  assert_equal 12, @decrypter.header_bytesize
end

#test_reset!Object



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/hotplate/gems/rubyzip-1.1.7/test/crypto/traditional_encryption_test.rb', line 69

def test_reset!
  @decrypter.reset!([239, 57, 234, 154, 246, 80, 83, 221, 74, 200, 121, 91].pack("C*"))
  [100, 218, 7, 114, 226, 82, 62, 93, 224, 62].map(&:chr).each do |c|
    assert_equal 'a', @decrypter.decrypt(c)
  end
  assert_equal 91.chr, @decrypter.decrypt(2.chr)
  @decrypter.reset!([239, 57, 234, 154, 246, 80, 83, 221, 74, 200, 121, 91].pack("C*"))
  [100, 218, 7, 114, 226, 82, 62, 93, 224, 62].map(&:chr).each do |c|
    assert_equal 'a', @decrypter.decrypt(c)
  end
end