Skip to content

xndadelin/pydecodr

Repository files navigation

pydecodr

A modular CTF/crypto library toolkit for encodings, classic ciphers, and autodetection. CLI included :3.

pydecodr is a Python package that lets you encode, decode, encrypt or decrypt text using classical, polyalphabetic, modern, and stream ciphers, all through a Python API and a CLI interface


Features:

  • classical ciphers: (caesar, atbash, affine, rot13, substitution, hill, polybius, 4square, bacon)
  • polyalphabetic: (vigenere, autokey_vigenere, beaufort, playfair, gronsfeld)
  • fractionation: (bifid, ADFGX, trifid, ADFGVX)
  • transposition: (railfence, columnar, double transposition, myszkowski, route)
  • stream: (xor, repeating xor, rc4)
  • modern: (aes, rsa, hash utilities)
  • encodings: (b32, b64, hex, URL-safe, morse, base85)
  • detection & utils: (file magic detection, I/O helpers)
  • cli interface

Installation

pip install pydecodr

Usage

CLI interface

You can use any cipher module directly with Python's -m flag:

# caesar cipher
python3 -m pydecodr.ciphers.classical.caesar encrypt "HELLO" 3
# -> KHOOR

python3 -m pydecodr.ciphers.classical.caesar decrypt "KHOOR" 3
# -> HELLO

Python API

from pydecodr.ciphers.classical import caesar
from pydecodr.ciphers.polyalphabetic import vigenere

print(caesar.encrypt("HELLO", 3))
# KHOOR

print(vigenere.encrypt("HELLOWORLD", "KEY"))
# RIJVSUYVJN

Or load dynamically using the global registry:

from pydecodr import load_module

mod = load_module("adfgx")
ciphertext = mod.encrypt("DEFEND THE EAST WALL", "FORTIFICATION", "CIPHER")
print(mod.decrypt(ciphertext, "FORTIFICATION", "CIPHER"))

Check this for more usage: usage

About

A modular CTF/crypto library toolkit for encodings, classic ciphers, and autodetection. CLI included :3.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages