Cryptanalysis & Automation

ASCII Caesar Cipher Bruteforcer

An automated Python security tool designed to crack shift ciphers across the printable ASCII range.

Python Cryptanalysis ASCII Mathematics Automation

Project Overview

The ASCII Caesar Cipher Bruteforcer is a lightweight command-line security utility that automates the decryption of shift-ciphered texts. While a standard Caesar cipher typically limits itself to the 26 letters of the English alphabet, this implementation expands the attack surface to include the entire set of printable ASCII characters (characters 32 to 126).

By iterating programmatically through every mathematical key space offset, the script reveals the correct key and deciphered output within milliseconds, demonstrating how quickly weak or single-byte symmetric algorithms fall to automated, algorithmic decryption.

Technical Architecture & The Decryption Logic

To support punctuation, symbols, numbers, and spaces without breaking the output structure, the script utilizes modulo arithmetic bounded to the printable ASCII range ($32$ to $126$):

Ciphertext Input
ASCII Ordinal mapping
$(ord(char) - key) \pmod{126}$
Boundary Correction (+95)
Printable Outputs

Key Mechanics

Key Python Implementation

Below is the modular execution loop managing character normalization, bounds checking, and key space iteration:

# The decryption engine managing ASCII boundary adjustments
def decrypt(key, cipher):
    plaintext = ''

    for each in cipher:
        # Shift character backwards by key amount and apply modulo
        p = (ord(each) - key) % 126

        # Check if shift falls into non-printable ASCII range (< 32)
        if p < 32:
            p += 95 # Wrap back up into the printable character limit

        plaintext += chr(p)

    print str(key) + ': ' + plaintext

Key Engineering Takeaways