A wrapper for python encryption to aid in the use of one-way and two-way encryption.
Project description
Lab93-Cryptogram
A small tool for encrypting and decrypting secrets.
Installation
pip install --upgrade Lab93Cryptogram
Usage
The CryptographyMethodsAPI
object has to be instantiated before any
of the inner methods can be accessed.
from Lab93Cryptogram import CryptogaphyMethodsAPI as cryptogram
SHA-256
SHA-256 offers a nearly unbreakable one-way encryption for hashing a secret meant to validate another parties identity.
username = cryptogram().SHA256( "hunter" )
password = cryptogram().SHA256( "lol you thought" )
BuildKey
In order to use two-way encryption there exists the need for a secret key known only to the parties intended to access the secret. To generate a key with the CryptographyMethodsAPI, we simply give a string to the BuildKey function; which then converts the string to a SHA256 hash and takes the first 32 bytes from the result and uses that as the key.
encryption_key = cryptogram().BuildKey( f"{username}{password}" )
Encryption
To encrypt a two-way credential, simply plug the previously built key along with the target string to the Encryption method like so.
encrypted_secret = cryptogram().Encryption( encryption_key,
"This would be an API key." )
Decryption
Decryption works exactly the same as Encryption; by taking the encryption key and the target string previously encrypted it reverses the obsfuscation brough by the previous action.
decrypted_secret = cryptogram().Decryption( encryption_key,
encrypted_secret )
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 Distribution
Built Distribution
Hashes for lab93cryptographyapi-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99539fa76d41c88df6d6383e703688867cb1d897bf5bddfa786d83f6b39c17e9 |
|
MD5 | 83336e2544853e18cee95a6e6540de3a |
|
BLAKE2b-256 | 5c1220f9d7f29d67344b7d24a15a4f8e2e93ed0b70487a78481b6456c146bce8 |
Hashes for Lab93CryptographyAPI-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf13b499b3b034874c99336258d76a58f74102431bfef2c2ef8242935371a880 |
|
MD5 | 4b50fbe82f4866a4b29ea58e4fbf16de |
|
BLAKE2b-256 | 817cf171347de7f2c0d40e2a5873fea2c85908f64b5d9b658d6a02295959816d |