Of course similar questions have been asked in stackoverflow but I don't want to use any third party library like Crypto or something. So I need to generate a ciphertext from a user email and decrypt it back to plaintext. How can I do this in python?
Python has no built-in encryption schemes, no. You also should take encrypted data storage serious; trivial encryption schemes that one developer understands to be insecure and a toy scheme may well be mistaken for a secure scheme by a less experienced developer. If you encrypt, encrypt properly.
The result of this encryption is known as a “Fernet token” and has strong privacy and authenticity guarantees. data (bytes) – The message you would like to encrypt. A secure message that cannot be read or altered without the key. It is URL-safe base64-encoded.
A third-party system is your best bet.
If you really can't/don't want to use a third-party, maybe something simple would suffice.
One of the simpler algorithms is the Tiny Encryption Algorithm (TEA). Here's an example of a Python implementation that you could start with.
Yes, you can. Read http://www.amk.ca/python/code/crypto.html You'll find an answer there ;)
You're question is not concrete enough to say more. You may want to read http://en.wikipedia.org/wiki/Cryptography#Modern_cryptography
Cheers, Tuergeist
Update: No, you cannot. (with build in functionality due to export restrictions, see http://docs.python.org/library/crypto.html) But you can, if you're implementing you own algorithm (bad idea). So, the BEST solution is, to use the extension recommended by python core developers. See post above.
Cheers again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With