# Path: kale/crypt.py
# BLOCK_SIZE = 16
# def _set_cipher():
# def encrypt(msg):
# def decrypt(msg):
# def urlsafe_encrypt(msg):
# def hex_encrypt(msg):
# def hex_decrypt(msg):
# def urlsafe_decrypt(msg):
# def _pad(msg):
# def _get_padding_bytes(msg_length):
# def _unpad(msg):
# class CryptException(Exception):


import unittest
from kale import crypt
            crypted_msg = crypt.encrypt(msg)
            self.assertEqual(msg, crypt.decrypt(crypted_msg))

    def test_urlsafe_crypt(self):
        [self.assertNotEqual(msg, crypt.urlsafe_encrypt(msg)) for msg in self.msgs]

    def test_urlsafe_decrypt(self):
        for msg in self.msgs:
            crypted_msg = crypt.urlsafe_encrypt(msg)
            self.assertEqual(msg, crypt.urlsafe_decrypt(crypted_msg))

    def test_hex_crypt(self):
        [self.assertNotEqual(msg, crypt.hex_encrypt(msg)) for msg in self.msgs]

    def text_hex_decrypt(self):
        for msg in self.msgs:
            crypted_msg = crypt.hex_encrypt(msg)
            self.assertEqual(msg, crypt.hex_decrypt(crypted_msg))

    def test_crypt_order_doesnt_matter(self):
        # This is effectively a test that we are using ECB (or some other non-chained)
        # mode of operation, because as long as we are it's fine to keep using the same
        # cipher object over and over. If we switched to a chained mode, this test would
        # break and we would need to create a new cipher object (and IV and/or nonce,
        # depending on mode) for every message.
        crypted_msgs = {msg: crypt.encrypt(msg) for msg in self.msgs}
        # Reset to a new cipher
        crypt._set_cipher()
        self.msgs.reverse()
        crypted_in_reverse = {msg: crypt.encrypt(msg) for msg in self.msgs}

# Path: kale/crypt.py
# BLOCK_SIZE = 16
# def _set_cipher():
# def encrypt(msg):
# def decrypt(msg):
# def urlsafe_encrypt(msg):
# def hex_encrypt(msg):
# def hex_decrypt(msg):
# def urlsafe_decrypt(msg):
# def _pad(msg):
# def _get_padding_bytes(msg_length):
# def _unpad(msg):
# class CryptException(Exception):


# Path: kale/tests/test_crypt.py
import unittest
from kale import crypt

            crypted_msg = crypt.encrypt(msg)
            self.assertEqual(msg, crypt.decrypt(crypted_msg))

    def test_urlsafe_crypt(self):
        [self.assertNotEqual(msg, crypt.urlsafe_encrypt(msg)) for msg in self.msgs]

    def test_urlsafe_decrypt(self):
        for msg in self.msgs:
            crypted_msg = crypt.urlsafe_encrypt(msg)
            self.assertEqual(msg, crypt.urlsafe_decrypt(crypted_msg))

    def test_hex_crypt(self):
        [self.assertNotEqual(msg, crypt.hex_encrypt(msg)) for msg in self.msgs]

    def text_hex_decrypt(self):
        for msg in self.msgs:
            crypted_msg = crypt.hex_encrypt(msg)
            self.assertEqual(msg, crypt.hex_decrypt(crypted_msg))

    def test_crypt_order_doesnt_matter(self):
        # This is effectively a test that we are using ECB (or some other non-chained)
        # mode of operation, because as long as we are it's fine to keep using the same
        # cipher object over and over. If we switched to a chained mode, this test would
        # break and we would need to create a new cipher object (and IV and/or nonce,
        # depending on mode) for every message.
        crypted_msgs = {msg: crypt.encrypt(msg) for msg in self.msgs}
        # Reset to a new cipher
        crypt._set_cipher()
        self.msgs.reverse()
        crypted_in_reverse = {msg: crypt.encrypt(msg) for msg in self.msgs}

        [self.assertEqual(crypted_msgs[msg],