The next program is an implementation of the ChaCha20 Stream Cipher written in Python, the objective is to generate a key stream from an specific input in order to encrypt/decrypt any kind of text.
Stream ciphers are symmetric key cipher where plaintext digits are combined with a pseudorandom cipher digit stream (keystream).
ChaCha20 is a stream cipher designed by Daniel J. Bernstein. The secret key is 256 bits long (32 bytes). The cipher requires a nonce, which must not be reused across encryptions performed with the same key.
ChaCha20 and XChaCha20 - PyCryptodome's documentation
- Encryption and Decryption of any text.
- Customized inputs.
- Ascii Code-Text Convertion.
- Support Keys of variable length.
- Support for Hexadecimal or Decimal Formats.
git clone https://github.com/iluzioDev/ChaCha20-cipher
cd ChaCha20-cipher
python3 ChaCha20-cipher.py
Once executed, a menu will prompt asking for desired option:
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
■ WELCOME TO THE CHACHA20 CIPHER TOOL! ■
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
What would you want to do?
[1] Cipher Message.
[2] Cipher Ascii Code of Message.
[3] Cipher Message in Hexadecimal.
[4] Convert Ascii Code to Text.
[5] Convert Text to Ascii Code.
[0] Exit.
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
Option ->
- Encrypts/Decrypts a message after inserting key, counter and nonce values. The program will generate a key stream to make a XOR operation with the message.
- Similar to option 1, encrypts/decrypts a message giving its ascii code
(no plain text!)
. - Similar to option 1, encrypts/decrypts a message in hexadecimal form
(no plain text)
. - Converts a given ascii code to its corresponding string. It's important to notice that the ascii code of each character has 3 digits!
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
Introduce ascii code: 072101108108111
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
OUTPUT TEXT: Hello
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
- Similar to option 4, converts a string to its corresponding ascii code
IluzioDev 💻 |
Distributed under the MIT License. Click here for more information.