Skip to content

A simple python script that offers multiple simple implementations for encryption techniques. Done as a project for ASU 2020, Computer and Network Security course.

License

Notifications You must be signed in to change notification settings

MohamedSaidSallam/Encryption-Techniques

Repository files navigation

Encryption Techniques Python

GitHub Release License

A simple python script that offers multiple simple implementations for encryption techniques. Done as a project for ASU 2020, Computer and Network Security course.

Supported Encryption Techniques:

  • AES
  • DES
  • Playfair Cipher
  • Hill Cipher
  • Vernam Cipher
  • Vigenere Cipher
  • Ceasar Cipher

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Install the requirements using the following:

pip install -r requirements.txt

or if you are using python venv:

python -m venv venv
venv/Scripts/activate
pip install -r requirements.txt

Running the code

you can get the list of paramters using the following:

python -m encryption --help

or

venv\Scripts\python.exe -m encryption --help

or

venv/Scripts/activate
python -m encryption --help

Output:

usage: __main__.py [-h] -i INPUT [-o OUTPUT] [--caesarCipherEncrypt]
                   [--vigenereCipherEncrypt] [--vernamCipherEncrypt]
                   [--hillCipherEncrypt] [--playfairCipherEncrypt]
                   [--DESEncrypt] [--DESDecrypt] [--AESEncrypt] [--AESDecrypt]
                   ...

A simple python script that offers multiple simple impementation for
encryption techniques.

positional arguments:
  algoParam

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Path to input file
  -o OUTPUT, --output OUTPUT
                        Path to output file. (default: output.txt)
  --caesarCipherEncrypt
                        selects 'caesarCipherEncrypt' as the encryption
                        technique to use. (parameters: key size (shift),
                        default: 3)
  --vigenereCipherEncrypt
                        selects 'vigenereCipherEncrypt' as the encryption
                        technique to use. (parameters: mode(0: repeating, 1:
                        auto), key)
  --vernamCipherEncrypt
                        selects 'vernamCipherEncrypt' as the encryption
                        technique to use. (parameters: key)
  --hillCipherEncrypt   selects 'hillCipherEncrypt' as the encryption
                        technique to use. (parameters: key matrix (elements
                        seperated by ',', e.g. 5,17,8,3))
  --playfairCipherEncrypt
                        selects 'playfairCipherEncrypt' as the encryption
                        technique to use. (parameters: key)
  --DESEncrypt          selects 'DESEncrypt' as the encryption technique to
                        use. (parameters: key(16 Hex Chars), Number of rounds)
  --DESDecrypt          selects 'DESDecrypt' as the encryption technique to
                        use. (parameters: key(16 Hex Chars), Number of rounds)
  --AESEncrypt          selects 'AESEncrypt' as the encryption technique to
                        use. (parameters: Key (32 Hex characters))
  --AESDecrypt          selects 'AESDecrypt' as the encryption technique to
                        use. (parameters: Key (32 Hex characters))

Source: https://github.com/TheDigitalPhoenixX/Encryption-Techniques

Run Example Input

Classical Ciphers:

py -m encryption -i "input examples/Caesar/caesar_plain.txt" -o caesar_3.txt --caesarCipherEncrypt 3
py -m encryption -i "input examples/Caesar/caesar_plain.txt" -o caesar_6.txt --caesarCipherEncrypt 6
py -m encryption -i "input examples/Caesar/caesar_plain.txt" -o caesar_12.txt --caesarCipherEncrypt 12
py -m encryption -i "input examples/Hill/hill_plain_2x2.txt" -o hill_2x2.txt --hillCipherEncrypt 5,17,8,3
py -m encryption -i "input examples/Hill/hill_plain_3x3.txt" -o hill_3x3.txt --hillCipherEncrypt 2,4,12,9,1,6,7,5,3
py -m encryption -i "input examples/PlayFair/playfair_plain.txt" -o playfair_rats.txt --playfairCipherEncrypt rats
py -m encryption -i "input examples/PlayFair/playfair_plain.txt" -o playfair_archangel.txt --playfairCipherEncrypt archangel
py -m encryption -i "input examples/Vernam/vernam_plain.txt" -o vernam_txt --vernamCipherEncrypt SPARTANS
py -m encryption -i "input examples/Vigenere/vigenere_plain.txt" -o vigenere_true.txt --vigenereCipherEncrypt 1 aether
py -m encryption -i "input examples/Vigenere/vigenere_plain.txt" -o vigenere_false.txt --vigenereCipherEncrypt 0 pie

DES:

py -m encryption -i "input examples/des.txt" -o des_1.txt --DESEncrypt 0000000000000000 1
py -m encryption -i "input examples/des.txt" -o des_2.txt --DESEncrypt 0000000000000000 2
py -m encryption -i "input examples/des_decrypt_1.txt" -o des_decrypt_1.txt --DESDecrypt 0000000000000000 1
py -m encryption -i "input examples/des_decrypt_2.txt" -o des_decrypt_2.txt --DESDecrypt 0000000000000000 2

AES:

py -m encryption -i "input examples/aes.txt" -o aes.txt --AESEncrypt 0123456789ABCDEF0123456789ABCDEF
py -m encryption -i "input examples/aes_decrypt.txt" -o aes_decrypt.txt --AESDecrypt 0123456789ABCDEF0123456789ABCDEF

Built With

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project and their work in CONTRIBUTORS.md.

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

About

A simple python script that offers multiple simple implementations for encryption techniques. Done as a project for ASU 2020, Computer and Network Security course.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages