Skip to main content

Simple, secure 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.
  • The established, efficient pycrypto library provides the algorithm implementations (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 will help support an upgrade path (I can’t promise full backwards support, because any solution will depend on the attack, but at least the needed information is present).

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


Release history Release notifications

History Node

4.1.7

History Node

4.1.6

History Node

4.1.5

History Node

4.1.4

History Node

4.1.3

History Node

4.1.2

History Node

4.1.1

History Node

4.1.0

History Node

4.0.0

History Node

3.0.2

History Node

3.0.1

History Node

3.0.0

History Node

2.0.1

History Node

2.0.0

History Node

1.0.0

History Node

0.2.0

History Node

0.1.13

History Node

0.1.12

History Node

0.1.11

This version
History Node

0.1.10

History Node

0.1.9

History Node

0.1.8

History Node

0.1.7

History Node

0.1.6

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
simple-crypt-0.1.10.tar.gz (6.1 kB) Copy SHA256 hash SHA256 Source None Dec 28, 2012

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page