#A simple encryption program

6 messages · Page 1 of 1 (latest)

vagrant finch
#
import random
import string

chars = list(" " + string.punctuation + string.ascii_letters + string.digits)
key = chars.copy()

random.shuffle(key)

userInput = list(input("Input the text you'd like encrypted: "))

for i, character in enumerate(userInput):
    currentCharacterInChars = chars.index(character)

    userInput[i] = key[currentCharacterInChars]

userInput = "".join(userInput)

print(userInput)

tribal blaze
#

Great. So how will you decrypt it?

vagrant finch
#
for i, encryptedCharacter in enumerate(userInput):
    currentCharacterInKey = key.index(encryptedCharacter)

    userInput[i] = chars[currentCharacterInKey]
tribal blaze