Skip to main content

Easy Encryption

Source: https://github.com/WKHAllen/easyencrypt

Contents

Hashing, symmetric encryption, and public/private key encryption functions.

Dependencies

Installation

pip install easyencrypt

Example

>>> # hashing
>>> from easyencrypt import newSalt, hashText
>>> newSalt()
b"b\xa3\x1c\xf5Y\xe2;\xb9\xa6\xaeUz\xde\x88\x07\xfe'\xc9\xaa\x96\xdfBh\xc9\xf9\x04\xb26\xff\xa9zJ\x17\xd5\x01n\xfeV\xa7$\xa8`G\xfd\r]\x8a`\xeaL4\x02{\xd6\x9b\xb3\xa9\xd9\x89\x18;\xec\xab\x83"
>>> message = "Hello, World!"
>>> hashText(message, algorithm="sha256")
b'\xdf\xfd`!\xbb+\xd5\xb0\xafgb\x90\x80\x9e\xc3\xa51\x91\xdd\x81\xc7\xf7\nK(h\x8a6!\x82\x98o'
>>> # symmetric encryption/decryption
>>> from easyencrypt import newKey, passwordToKey, symmetricEncrypt, symmetricDecrypt
>>> newKey()
b'1h8_Z3LcL55r3ljklF_1fhKWy122zqDYWAJyQEZaKlA='
>>> password = "password123"
>>> key = passwordToKey(password)
>>> key
b'75K3eLr-dx6JJFuJ7LwIpEpOFmwGZZkRiB84PURz6U8='
>>> ciphertext = symmetricEncrypt(message, key)
>>> ciphertext
b"\x80\x00\x00\x00\x00[B?\xe7\xbb\x825s\xff\xf3\x92AX|$\xf5\x19\x16\xe7f\x98\x8cgND\xf8\xdf\xd4Q\x00Y\xe5v\xb9\x0e\xa0\xa0\xb8\x05\x87N\xe6\x19h\x93K\xa9\xdb\x11\xef%V\xc2\xb1'\xa4;\xb8\xaf\xd2[\xdc\xb2\xae\xea\xca\xa4z"
>>> symmetricDecrypt(ciphertext, key)
b'Hello, World!'
>>> # public/private key encryption/decryption
>>> from easyencrypt import newKeyPair, encrypt, decrypt
>>> pub, priv = newKeyPair()
>>> ciphertext = encrypt(message, pub)
>>> ciphertext
b"\x01@H\x16\xe5\x01\xc0\x02)\x13\x8e\xba\xbb{p_5t\xf1\x81\x18y2\x12=t\xfe\xeb(\xcf\xce\xdd\xbd'\xb2\xddS\xbd\x0e\xc3\xf5\x0b-\xd8{\xe3W\xd5\xe8)_\xa8\xfb\x11\x8d\xb2\xb0l\x04\xf2>\xd9`\x0cS\xb9"
>>> decrypt(ciphertext, priv)
b'Hello, World!'

Release files for easyencrypt 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for easyencrypt 0.1.0
File Interpreter ABI Platform
easyencrypt-0.1.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Release files / easyencrypt-0.1.0-py2.py3-none-any.whl

Download URL easyencrypt-0.1.0-py2.py3-none-any.whl
Size 4.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8b01c8dbaf16b1f2aef6edd5989405497517073ae2e9728b5c2271f73a459f39
BLAKE2b-256 checksum
How to use checksums
3048ae1e242d49703aa8e90748378abec58ddd7cefaf9da262cd0a8f238daa92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

0.0.1

1 release file

0.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page