<commit_before>"""
cryptography.py
Author: <NAME>
Credit: classmates, the internet, Mr. Dennison

Assignment:

Write and submit a program that encrypts and decrypts user data.

See the detailed requirements at https://github.com/HHS-IntroProgramming/Cryptography/blob/master/README.md
"""
associations = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 .,:;'\"/\\<>(){}[]-=_+?!"

edq = input("Enter e to encrypt, d to decrypt, or q to quit: ")
enumlist = []
ekeynumlist = []
enewnums = []
eend = []
dnumlist = []
dkeynumlist = []
dnewnums = []
dend = []

while edq != "q":
    
    if edq == "e":
        emessage = input("Message: ")
        ekey = input("Key: ")
        eeekey = ekey
        while len(ekey) < len(emessage):
            ekey = ekey + eeekey
        for x in emessage:
            enumlist.append(associations.find(x))
        for y in ekey:
             ekeynumlist.append(associations.find(y))
             
        ezip = list(zip(enumlist, ekeynumlist))
        
        for a in ezip:
            if a[0]+a[1] < len(associations):
                enewnums.append(a[0] + a[1])
            else:
                enewnums.append(a[0] + a[1] - len(associations))
        
        for i in enewnums:
            eend.append(associations[i])
            
        print(''.join(eend))

# (1,2),(3,4)

    if edq == "d":

        dmessage = input("Message: ")
        dkey = input("Key: ")
        deekey = dkey
        while len(dkey) < len(dmessage):
            dkey = dkey + deekey
        for x in dmessage:
            dnumlist.append(associations.find(x))
        for y in dkey:
            dkeynumlist.append(associations.find(y))<commit_msg>Updated from Brython Server: 11/6/2015 2:43:05 PM<commit_after>"""
cryptography.py
Author: <NAME>
Credit: classmates, the internet, Mr. Dennison

Assignment:

Write and submit a program that encrypts and decrypts user data.

See the detailed requirements at https://github.com/HHS-IntroProgramming/Cryptography/blob/master/README.md
"""
associations = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 .,:;'\"/\\<>(){}[]-=_+?!"

edq = input("Enter e to encrypt, d to decrypt, or q to quit: ")
enumlist = []
ekeynumlist = []
enewnums = []
eend = []
dnumlist = []
dkeynumlist = []
dnewnums = []
dend = []

while edq != "q":
    
    if edq == "e":
        emessage = input("Message: ")
        ekey = input("Key: ")
        eeekey = ekey
        while len(ekey) < len(emessage):
            ekey = ekey + eeekey
        for x in emessage:
            enumlist.append(associations.find(x))
        for y in ekey:
            ekeynumlist.append(associations.find(y))
             
        ezip = list(zip(enumlist, ekeynumlist))
        
        for a in ezip:
            if a[0]+a[1] < len(associations):
                enewnums.append(a[0] + a[1])
            else:
                enewnums.append(a[0] + a[1] - len(associations))
        
        for i in enewnums:
            eend.append(associations[i])
            
        print(''.join(eend))

# (1,2),(3,4)

    if edq == "d":

        dmessage = input("Message: ")
        dkey = input("Key: ")
        deekey = dkey
        while len(dkey) < len(dmessage):
            dkey = dkey + deekey
        for x in dmessage:
            dnumlist.append(associations.find(x))
        for y in dkey:
            dkeynumlist.append(associations.find(y))
{'fraction_non_alphanumeric': 0.13688548719458346, 'fraction_numerical': 0.015307624374448043, 'mean_word_length': 2.1346863468634685, 'pattern_counts': {'":': 6, '<': 13, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '57509', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1180, 'n_words': 257}