Skip to main content

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


Download files

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

Source Distribution

lab93cryptographyapi-0.0.1.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

Lab93CryptographyAPI-0.0.1-py3-none-any.whl (3.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page