Skip to main content
https://travis-ci.org/boppreh/simplecrypto.png?branch=master https://coveralls.io/repos/boppreh/simplecrypto/badge.png https://badge.fury.io/py/simplecrypto.png

Cryptographic library with really simple API.

Includes functions for hashes, symmetric and asymmetric crypto, along with helper functions. Acts as a wrapper for PyCrypto and a few standard libraries.

Documentation

Documentation is available at http://simplecrypto.readthedocs.org.

The full source code repository is at https://github.com/boppreh/simplecrypto.

Installation

pip install simplecrypto

This library depends on PyCrypto. On Linux this is installed automatically by pip. If the dependency installation fail on Windows, you may want to use a prebuilt installer. If you wish to compile it I suggest using the Mingw tools as indicated here.

Usage

from simplecrypto import sha1, encrypt, decrypt, RsaKeypair, base64

sha1('The quick brown fox jumps over the lazy dog')
# '2fd4e1c67a2d28fced849ee1bb76e7391b93eb12'

# `encrypt` and `decrypt` use AES-256.
m = encrypt('secret message', 'secret key')
print(m)
# 'uRKa9xX7zW6QT1yJxIQb5E/0DzaxQglVggnFam5K'
decrypt(m, 'secret key')
# b'secret message'

skey = RsaKeypair(2048)
pkey = skey.publickey

m = pkey.encrypt('secret message')
skey.decrypt(m)
# b'secret message'

s = skey.sign('authenticated message')
pkey.verify('authenticated message', s)
# True

base64('message')
# 'bWVzc2FnZQ=='

Last Updates

0.3.4 (2022-08-24)

  • Update metadata.

0.3.3 (2015-8-07)

  • Package tests.

0.3.2 (2014-3-30)

  • Add HMAC support.

  • Use SHA256 as default RSA hash

  • Allow selection of PRNG used for RSA key generation

  • Minor changes for better Python2 support

0.3.1 (2013-12-06)

  • Add project to Travis and Coverall.

  • Increase test coverage to 100%.

  • Add installation instructions.

  • Rename guess_hash to guess_transformation.

0.3.0 (2013-12-05)

  • Add serialize to RSA keys.

  • Allow RSA keys to receive PEM encoded keys in the constructor.

  • Implement __repr__ method in base Key class (you can now print keys).

  • Split package into modules key, formats, hashes, random and exceptions.

0.2.3 (2013-12-05)

  • Update project information (keywords, classifiers, description, etc).

0.2.2 (2013-12-04)

  • Add send and receive functions for secure message building.

  • Raise EncryptionError instead of generic errors.

  • Slightly better test coverage.

0.2.1 (2013-12-03)

  • Add base Key class.

  • Introduce raw versions of encrypt and decrypt.

  • Implemented key printing and comparison.

0.2.0 (2013-12-03)

  • Return str from to_base64 and allow from_base64 to receive str.

  • Create classes for different key types.

  • Change return from to_hex to str for consistency with base64.

  • guess_hash function moved to different module.

  • Automatically use session keys when encrypting large messages.

0.1.0 (2013-11-26)

  • Initial release.

Download files

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

Source Distribution

simplecrypto-0.3.4.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simplecrypto-0.3.4-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file simplecrypto-0.3.4.tar.gz.

File metadata

  • Download URL: simplecrypto-0.3.4.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for simplecrypto-0.3.4.tar.gz
Algorithm Hash digest
SHA256 f75c7612bc4e160c7549a2524e9f984aad0e3957e7c0b216d669b2fc8f2acc0c
MD5 69980e6ac1d50dd21aa19af43c6e6de3
BLAKE2b-256 c630c8fe43d38a06a750392ad60babbc4d438c52f6bdbb30dab9d7ffd53062ec

See more details on using hashes here.

File details

Details for the file simplecrypto-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: simplecrypto-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for simplecrypto-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c8c7e6defe8f936f6587ad02d89d84f3003000a8b24116a861969efabf1783c8
MD5 63929cf6245282d11ffc6284e16dae70
BLAKE2b-256 d64865e88236fcbc19fd6ada22b766f3b0ec072528f3540cc393e2dc67b5d8e2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.4 This release

2 files

0.3.3

2 files

0.3.2

1 file

0.3.1

1 file

0.3.0

1 file

0.2.3

1 file

0.2.2

1 file

0.2.1

1 file

0.2.0

1 file

0.1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page