Created
December 12, 2014 06:40
-
-
Save saurabhwahile/98eeb2ab8363c9189b21 to your computer and use it in GitHub Desktop.
Analyse Substitution Cipher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from string import ascii_lowercase | |
ITERATIONS = 3 | |
charMapping = {} | |
charControl = 0 | |
for char in ascii_lowercase: | |
charMapping[charControl] = char | |
charControl+=1 | |
CODE = 'VHFXULWB' | |
CODE = CODE.lower() | |
def applyIteration(code, key): | |
print 'Key='+str(key) | |
result = '' | |
for char in code: | |
result = result + charMapping[(ascii_lowercase.find(char)+key)%26] | |
print result | |
for key in range(26): | |
applyIteration(CODE, key) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment