File: rc4_decrypter.py

package info (click to toggle)
dfvfs 20190128-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 105,268 kB
  • sloc: python: 25,003; sh: 369; makefile: 30; vhdl: 25
file content (27 lines) | stat: -rw-r--r-- 704 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the RC4 decrypter object."""

from __future__ import unicode_literals

import unittest

from dfvfs.encryption import rc4_decrypter

from tests.encryption import test_lib


class RC4DecrypterTestCase(test_lib.DecrypterTestCase):
  """Tests for the RC4 decrypter object."""

  def testDecrypt(self):
    """Tests the Decrypt method."""
    decrypter = rc4_decrypter.RC4Decrypter(key=b'test')

    decrypted_data, _ = decrypter.Decrypt(b'\xaf\x8d\x24\x15\xe5\x2c\x7a\x2d')
    expected_decrypted_data = b'\x01\x02\x03\x04\x05\x06\x07\x08'
    self.assertEqual(decrypted_data, expected_decrypted_data)


if __name__ == '__main__':
  unittest.main()