Skip to main content

Simple encryption and decryption for Python 3

Project description

What Does Simple Crypt Do?

Simple Crypt encrypts and decrypts data. It has two functions, encrypt and decrypt:

from simplecrypt import encrypt, decrypt
ciphertext = encrypt('password', plaintext)
plaintext = decrypt('password', ciphertext)

That’s it. You can see the implementation on github.

Why Should I Use Simple Crypt?

  • It uses standard, well-known algorithms, closely following the recommendations here.

  • It uses routines from the established pycrypto library (the cipher used is AES256).

  • It includes a check (an HMAC with SHA256) to warn when ciphertext data are modified.

  • It tries to make things as secure as possible when poor quality passwords are used (PBKDF2 with SHA256, a 128 bit salt, and 10,000 rounds). But that doesn’t mean you should use a poor password!

  • Using a library, rather than writing your own code, means that we have less solutions to the same problem. That means more chance of finding bugs, which means more reliable, more secure code.

  • If simple-crypt does have a bug, the use of a header in the ciphertext data means that you will be able to deploy a fixed version that still handles older data. So you can safely update without breaking existing users.

What Else Should I Know?

  • You must also install pycrypto.

  • The outputs from encrypt and decrypt are bytes. If you started with string input then you can convert the output from decrypt using .decode('utf8').

mystring = decrypt('password', ciphertext).decode('utf8')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple-crypt-0.1.9.tar.gz (6.1 kB view details)

Uploaded Source

File details

Details for the file simple-crypt-0.1.9.tar.gz.

File metadata

File hashes

Hashes for simple-crypt-0.1.9.tar.gz
Algorithm Hash digest
SHA256 a419b1585d5708c178144fbddd29c33ed5e029323639395d18ab47b3620c84d0
MD5 bbc732c892156e76e7b2a1a25ed80849
BLAKE2b-256 f468d19f9d8eaf97dbc68f25185ba95a8edbc18c4b58d2b14f30d7077f4c7a18

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page