Skip to content

Latest commit

 

History

History
46 lines (30 loc) · 906 Bytes

File metadata and controls

46 lines (30 loc) · 906 Bytes

Simple encryption algorithms

Related article: https://bit.ly/3WfKXWK

Contents

  • Caesar cipher
  • Vigenère cipher
  • Bitwise rotation
  • XOR encryption

Usage

Replace 'cipher' for the appropriate word.

To encrypt:

python3 cipher.py file_to_encrypt key

To decrypt, use the '-d' flag (not necessary when using xor.py):

python3 cipher.py -d file_to_decrypt key

Optionally, you can specify the output file with '-o':

python3 cipher.py file_to_encrypt key -o output_file

To see the help use '-h':

python3 cipher.py -h

Alternatively, you can import the individual functions to play with them in your Python programs:

from cipher import cipher

Lastly, the key should be a string in the case of vigenere.py or xor.py, and an integer in the case of caesar.py and bitwise.py.