tiagolofi / sesma_app

Aplicação Streamlit para Tratamento de Dados da SES

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adição de Criptografia

FelipeMoraesA opened this issue · comments

commented
from random import sample
import re

dic = {
    'a': '$', 'b': '!', 'c': '7', 'd': 'd', 'e': '8',
    'f': '>', 'g': '#', 'h': '|', 'i': '4', 'j': 'j',
    'k': '+', 'l': 'x', 'm': '2', 'n': '5', 'o': '6',
    'p': '(', 'q':'12', 'r': 's', 's': '¬', 't': '¢',
    'u': ')', 'v': '@', 'w': 'm', 'x': '?', 'y': '3', 
    'z': '&', ',': 'º', ' ': sample(['0', '1'], 1)[0],
    '\n': sample(['0', '1'], 1)[0]
}

frase = '''There must be some kind of way outta here
Said the joker to the thief
Theres too much confusion
I cant get no relief
Business men, they drink my wine
Plowmen dig my earth
None will level on the line
Nobody offered his word
Hey, hey
No reason to get excited
The thief, he kindly spoke
There are many here among us
Who feel that life is but a joke
But, uh, but you and I, weve been through that
And this is not our fate
So let us stop talkin falsely now
The hours getting late, hey'''.lower()

cripto = ''.join([dic.get(i) for i in frase])

print(f'''A frase criptografada é "{cripto}".\n''')

decript = ''.join([' ' if i in ['0', '1'] else list(dic.keys())[list(dic.values()).index(i)] for i in cripto ])

print(f'''A frade descriptografada é "{decript}".''')

ok, meu amigo @FelipeMoraesA