A Rijndael-inspired cryptographic proof-of-concept algorithm.
View Demo
·
Report Bug
·
Request Feature
Table of Contents
Kato is a cryptographic proof-of-concept algorithm inspired by AES (Rijndael), or the Advanced Encryption Standard. As a symbol of power, Kato serves as a hybridization focusing on efficiency and versatility without compromising security. We welcome any and all contributions towards the implementation and empowerment of the algorithm, aiming to become more than just a conceptualized technology.
This is a minimal example of getting Kato operating locally. You may require additional steps, modification or a customized implementation to suit your needs.
This is an example of how to list things you need to use the software and how to install them.
- Python: https://www.python.org/downloads/
- Ensure you also have pip installed.
-
Clone the repo
git clone https://github.com/your_username_/Project-Name.git
OR
Install using pip from the Python Package Index (PyPI)
pip install kato
-
Import into your script
from kato import Kato
Below are the minimal usage examples, as well as the returned types from Kato.
Encrypting
ECB Mode:
from kato import Kato
key = bytes(random.sample(range(256), 16))
k = Kato(key)
ciphertext = k.encrypt(bytes("abcdefghijklmnop","utf-8"))
CBC Mode:
from kato import Kato
key = bytes(random.sample(range(256), 16))
iv = bytes(random.sample(range(256), 16))
k = Kato(key, iv)
ciphertext = k.encrypt(bytes("abcdefghijklmnop","utf-8"))
Decrypting
plaintext = k.decrypt(ciphertext)
Each Kato class instance will have a key (and optionally, an Initialization Vector) as an attribute. This means you will have to create new Kato instances for each key (and IV pair) you wish to use.
Types
-
Kato.init():
- key: 16 bytes
- iv (Optional): 16 bytes
-
Kato.encrypt(): Returns a 2D Array (list of lists)
- plaintext: 16 bytes
- Example Return:
[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
-
Kato.decrypt(): Returns a bytes object or 2D Array (list of lists)
- ciphertext: 16 bytes
- Example Return:
b'abcdefghijklmnop'
or[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
- Note: If any digit in the state matrix cannot be decoded into hex bytes, the function will return a 2D Array.
-
Kato.cipher_block_chaining(): Returns a bytes object.
- block: 16 bytes
- IV (Optional): 16 bytes
- Example Return:
b'\xxx\xxx\xxx\xxx'
- Note: This CBC implementation is NOT true CBC, instead a mock-CBC simplying XORing the IV with the block before encryption and after decryption.
-
Kato.transpose_matrix(): Returns a 2D Array (list of lists)
- matrix: 4x4 2D Array
- Example Return:
[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
-
Kato.omflip_matrix(): Returns a 2D Array (list of lists)
- matrix: 4x4 2D Array
- key: Array of 4 digits (default is
[3, 1, 0, 2]
) - Example Return:
[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
-
Kato.omflip_decrypt_matrix(): Returns a 2D Array (list of lists)
- matrix: 4x4 2D Array
- key: Array of 4 digits (default is
[3, 1, 0, 2]
) - Example Return:
[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
-
Kato.__add_round_key(): Returns a 2D Array (list of lists)
- state: 4x4 2D Array
- round_key: 16 bytes
- Example Return:
[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
- Add true CBC mode.
- C implementation.
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GPL3 License. See LICENSE.txt
for more information.
Leighton Brooks - leigh@ameasere.com
Milena Bosiacka - social
Riza Demirbas - social
Sam Truss - social
Yuliia Yavorska - social
Project Link: https://github.com/ameasere/kato
Use this space to list resources you find helpful and would like to give credit to. I've included a few of my favorites to kick things off!