Critography in Python

Asked

Viewed 84 times

-5

I just entered the programming area and my college ended up applying a work that we will have to create a program in Python that can perform encryption/ decryption of any message, encrypted or not.

The programme shall provide for the possibility of phrase encryption up to a limit of 128 characters, and decryption. The program must make use of a key cryptographic. The level of refinement, functionality, treatment of errors and extra functions implemented in this system, as well as the level complexity of the cryptographic technique chosen, will impact in the final note of this.

Based on this information I’d like to ask for everyone’s help.

What encryption do you recommend me to use as a base? Could you recommend places to learn how to create a good program?

From now on I am grateful!

  • Can you use ready-made libraries? Do you have to devise your own encryption method? What have you searched for?

1 answer

0

python has a standard library installed called Base64 which has functions to encode binary data in a string. It’s not exactly encryption (to the letter), but it can work to encrypt a message.

Example:

import base64

# codificando a mensagem

mensagemCodificada = base64.b64encode(b'data to be encoded')
# o 'b' antes da string é para transformá-la em binário.

print(mensagemCodificada)
resultado: b'ZGF0YSB0byBiZSBlbmNvZGVk'

# Decodificando a mensagem

mensagemLegivel = base64.b64decode(mensagemCodificada)

print(mensagemLegivel)
resultado: b'Uma mensagem a ser cifrada'

Once again, this is just a way to encrypt a message. I leave as a suggestion this link on Symmetric Encryption using python.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.