Skip to content
"Hacking Secret Ciphers with Python" programs
Python Shell
Find file
Latest commit b2cb30d Dec 6, 2014 @asweigart Updating pyperclip
Failed to load latest commit information.
README.md Updated with the book's new name. Oct 14, 2012
affineCipher.py Book typo fix: generateRandomKey() was not testing for relative prime… May 11, 2013
affineHacker.py Updates from Ari's edits and consistency checks. Mar 29, 2013
affineKeyTest.py Updates from Ari's edits and consistency checks. Mar 30, 2013
al_sweigart_privkey.txt Reverting key files back to their originals. Feb 26, 2013
al_sweigart_pubkey.txt Reverting key files back to their originals. Feb 26, 2013
buggy.py Updates from Ari's edits and consistency checks. Mar 30, 2013
caesarCipher.py Updates from Ari's edits and consistency checks. Mar 30, 2013
caesarCipher2.py Updates from Ari's edits and consistency checks. Mar 30, 2013
caesarHacker.py Updates from Ari's edits and consistency checks. Mar 30, 2013
codebreaker_unit_tests.py Got all the unit tests working again. Feb 25, 2013
coinFlips.py Updates from Ari's edits and consistency checks. Mar 30, 2013
cryptomath.py Various changes. Dec 13, 2012
detectEnglish.py Updates from Ari's edits and consistency checks. Mar 30, 2013
dictionary.txt Got all the unit tests working again. Feb 26, 2013
encrypted_file.txt Reverting key files back to their originals. Feb 26, 2013
frankenstein.txt Initial commit. Aug 19, 2012
freqAnalysis.py Got all the unit tests working again. Feb 26, 2013
freqFinder.py Various changes. This completely breaks the unit tests, I know. I'll … Jan 10, 2013
makeRsaKeys.py Got all the unit tests working again. Feb 26, 2013
makeWordPatterns.py Updates from Ari's edits and consistency checks. Mar 30, 2013
nullCipher.py Various changes. Dec 14, 2012
nullHacker.py Various changes. Dec 14, 2012
primeSieve.py Cleaning up test code that was left in by accident. Jan 11, 2013
pyperclip.py Updating pyperclip Dec 6, 2014
rabinMiller.py Book typo fix: Comment should say 'while' instead of 'until'. May 11, 2013
reverseCipher.py Various changes. Dec 14, 2012
rsaCipher.py Book typo fix: Comments should say that the block size needs to be LE… May 11, 2013
run_pylint.bat Adding pylint & unit test scripts. Aug 25, 2012
simpleSubCipher.py Various changes. This completely breaks the unit tests, I know. I'll … Jan 11, 2013
simpleSubDictionaryHacker.py Updates from Ari's edits and consistency checks. Mar 30, 2013
simpleSubHacker.py Cosmetic comment change Apr 5, 2013
simpleSubKeyword.py Various changes. Dec 14, 2012
transpositionDecrypt.py Updates from Ari's edits and consistency checks. Mar 30, 2013
transpositionEncrypt.py Updates from Ari's edits and consistency checks. Mar 30, 2013
transpositionFileCipher.py Updates from Ari's edits and consistency checks. Mar 30, 2013
transpositionFileHacker.py Various changes. Dec 14, 2012
transpositionHacker.py Updates from Ari's edits and consistency checks. Mar 30, 2013
transpositionTest.py Various changes. Dec 14, 2012
vigenereCipher.py Updates from Ari's edits and consistency checks. Mar 30, 2013
vigenereDictionaryHacker.py Updates from Ari's edits and consistency checks. Mar 30, 2013
vigenereHacker.py Comment changes. Apr 10, 2013

README.md

codebreaker

Hacking Secret Ciphers with Python" programs

This repo contains the source for the encryption and code breaking programs featured in the book "Hacking Secret Ciphers with Python".

Here's a general description of each of the files:

affineBreaker.py Break Affine Cipher-encrypted messages.

affineCipher.py Encrypt and decrypt using the Affine Cipher.

al_sweigart_privkey.txt A sample private key file that is used by the rsaCipher.py program.

al_sweigart_pubkey.txt A sample public key file that is used by the rsaCipher.py program.

buggy.py Used as practice for using Python's debugger.

caesarBreaker.py Break Caesar Cipher-encrypted messages.

caesarCipher.py Encrypts and decrypts using the Caesar Cipher.

coinFlips.py Used as practice for using Python's debugger.

detectEnglish.py Used to detect if a string is English.

dictionary.txt A dictionary file of English words, one per line.

encrypted_file.txt A sample encrypted file from the

frankenstein.txt A large text file sample. (The public domain novel Frankenstein.)

freqFinder.py Module for gathering letter frequency statistics.

makeRsaKeys.py Generate a public/private RSA key pair.

nullBreaker.py Breaks Null Cipher-encrypted messages.

nullCipher.py Encrypts and decrypts using the Null Cipher.

primeSieve.py Generates prime numbers using the Sieve of Erastothenes algorithm

pyperclip.py A module for copying and pasting to the clipboard. This source code isn't going to be featured in the book, and is only included so that people can test the programs that use it.

rabinMiller.py Module for primality testing using the Rabin-Miller algorithm.

README.md The file that you are reading right now, silly. :D

reverseCipher.py Encrypts with the reverse "cipher", which just reverse the string.

rsaCipher.py Encrypts and decrypts using the RSA Cipher.

simpleSubBreaker.py Breaks Simple Substitution Cipher-encrypted messages.

simpleSubCipher.py Encrypts and decrypts using the Simple Substitution Cipher.

simpleSubKeyword.py Encrypts and decrypts using the Simple Substitution Cipher, using an English word for the key.

transpositionBreaker.py Breaks Transposition Cipher-encrypted messages.

transpositionCipherFile.py Encrypts and decrypts files using the Transposition Cipher.

transpositionDecrypt.py Decrypts messages using the Transposition Cipher.

transpositionEncrypt.py Encrypts messages using the Transposition Cipher.

transpositionFileBreaker.py Breaks Transposition Cipher-encrypted files.

transpositionTest.py Tests to see if the Transposition Cipher program works.

vigenereBreaker.py Breaks Vigenere Cipher-encrypted messages.

vigenereCipher.py Encrypts and decrypts using the Vigenere Cipher.

Something went wrong with that request. Please try again.