Skip to main content

Simple encryption/decryption functions for Python

Project description

cryptofy

Simple encryption/decryption functions for Python

Installation

pip install cryptofy

Usage

Generate a secret:

from cryptofy import encoding, generate_secret

key = generate_secret().decode(encoding)

print(key)  # Output randomized secret

Encrypt a string:

from cryptofy import encoding, encrypt

string = "my-password"
key = "my-secret"

encrypted = encrypt(bytes(key, encoding=encoding), bytes(string, encoding))

print(encrypted)  # Output ciphertext

Decrypt ciphertext:

from cryptofy import encoding, decrypt

encrypted = "<ciphertext>"
key = "my-secret"

string = decrypt(bytes(key, encoding=encoding), encrypted).decode(encoding)

print(string)  # Output decrypted string

Command Line

Usage:

cryptofy ((-d | -e) -k <key> -s <source>) | (-n [-l <length>])

Example 1: Generate a secret

cryptofy -n

Example 2: Encrypt a string:

cryptofy -e -k "my-secret" -s "my-password"

Example 3: Decrypt ciphertext:

cryptofy -d -k "my-secret" -s "<ciphertext>"

License

Distributed under the Apache, version 2.0 license.

Project details


Download files

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

Files for cryptofy, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size cryptofy-1.1.0.tar.gz (6.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page