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
File details
Details for the file lab93cryptographyapi-0.0.1.tar.gz
.
File metadata
- Download URL: lab93cryptographyapi-0.0.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99539fa76d41c88df6d6383e703688867cb1d897bf5bddfa786d83f6b39c17e9 |
|
MD5 | 83336e2544853e18cee95a6e6540de3a |
|
BLAKE2b-256 | 5c1220f9d7f29d67344b7d24a15a4f8e2e93ed0b70487a78481b6456c146bce8 |
File details
Details for the file Lab93CryptographyAPI-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: Lab93CryptographyAPI-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf13b499b3b034874c99336258d76a58f74102431bfef2c2ef8242935371a880 |
|
MD5 | 4b50fbe82f4866a4b29ea58e4fbf16de |
|
BLAKE2b-256 | 817cf171347de7f2c0d40e2a5873fea2c85908f64b5d9b658d6a02295959816d |