Python Forum

Full Version: What is an Encryption And Decryption
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys so i got this one task that I should make an Encryption And Decryption in python so im curious what does that actually mean.
Thanks for your time
Rolleyes Idea
Code and decode
encryption is a method for transforming data into a secret form, using a secret key, that no one else can figure out unless they have the secret key and the decryption method. decryption is a method for transforming data from a secret form, using the same secret key used to encrypt it, back to its original form.

there is a type of encryption/decryption that uses two keys which are related to each other (and calculated together), one for encryption, the other for decryption.

to get started, don't worry if someone else can figure out your method and decrypt your data without being given the secret key.  you will need to worry about that later, when your method is to actually be used.
Encryption(Make eg (plaintext) that is human readable difficult to understand hide information).
Decryption(Take it back to normalized data (plaintext) that is human readable or the computer can understand).
>>> word = 'hello world'
>>> encrypt = word[::-1]
>>> encrypt
'dlrow olleh'

>>> decrypt = encrypt[::-1]
>>> decrypt
'hello world'
The two common encryption methods are symmetric and asymmetric. There are plenty of sources in www you can learn more

I see @Skaperen has explain them briefly
i was going to explain rot13 but @snippsat showed an even simpler method (no keys involved).
Hm! The simplest encryption for me is just to use a bitwise xor against some key.

>>> word = 'hello world'
>>> enc = "".join([chr(ord(char) ^ ord('a')) for char in word])
>>> enc
'\t\x04\r\r\x0eA\x16\x0e\x13\r\x05'
>>> dec = "".join([chr(ord(char) ^ ord('a')) for char in enc])
>>> dec
'hello world'
It's as simple as an 'Annie Oakly Code Wheel' from the Christmas Story,
or as a lifetime occupation . See: http://careersthatdontsuck.com/2007/02/2...ptologist/
(Jan-13-2017, 02:30 AM)Lamon112 Wrote: [ -> ]I should make an Encryption And Decryption in python so im curious what does that actually mean.


Hello friend, have you heard of this handy online dictionary? I forgot the name, but it really whips the lama's ass:

Encryption
Cryptography


In there, you can even click the blue words to get more information on adjacent ideas. I heard you can even ask questions to improve things, but that's just a rumor!