C# programs for some simple cryptography examples (Free .NET runtime needed to run the executables)

*NOTE* All ciphertext is assumed in upper case letters.

These probably work, they are all run from the command line in Windows, therefore you *must* download them first and invoke them from the command line.

Affine Cipher Brute Force

Prints out all 12*26 possible plaintexts for a given ciphertext, give the ciphertext (no spaces) as an argument on the command line

Affine Cipher Encryption and Decryption

Gives the ciphertext.  Three arguments required, plaintext with no spaces, the multiplicative constant, and the additive constant.  To decrypt, use the ciphertext and the appropriate constants for decryption.

Shift Cipher Brute Force

Simply prints out all 25 possibilities for a simple shift cipher.  Give ciphertext as argument.

Euclid's Algorithm

Find the gcd(a,b) using Euclid's algorithm.  Give a and b on the command line.

"Find Z_N star"

Finds the algebraic group "z_n star" for a given n.  Gives all numbers less than n that are relatively prime to n.

Primitive Roots

Gives the primitive roots of the integer specified.

Vigenere Encryption and Decryption

Encrypts (and decrypts) the common Vigenere cipher.  Give the text (no spaces) and the key as arguments.

Word pattern matcher

Finds words in a dictionary matching the pattern of a given word.  What are word patterns?  Each unique letter in a word is given a unique token.  For instance, 'bed' has pattern 'ABC', but 'bedtime' has pattern 'ABCDEFB'. 'Creeped' has pattern 'ABCCDCE'.  This program takes as input a file name of a (presumably large) dictionary file, and the word pattern.  It then prints all words from the dictionary file that match the given pattern.  Program is to be used for cracking a general substitution cipher.

Program sources in C# found here.