Hashing, symmetric encryption, and asymmetric encryption functions.
Project description
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!'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file easyencrypt-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: easyencrypt-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 2, Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b01c8dbaf16b1f2aef6edd5989405497517073ae2e9728b5c2271f73a459f39 |
|
MD5 | 53e00e35b0e0c19e4930fd7828b455ff |
|
BLAKE2b-256 | 3048ae1e242d49703aa8e90748378abec58ddd7cefaf9da262cd0a8f238daa92 |