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.

Source Distribution

cryptofy-1.1.0.tar.gz (6.8 kB view details)

Uploaded Source

File details

Details for the file cryptofy-1.1.0.tar.gz.

File metadata

  • Download URL: cryptofy-1.1.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.4

File hashes

Hashes for cryptofy-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6d1c03957bd9c98654158d305fc5ce521562606c2bc30ab5106f724cd7fc3a7f
MD5 67a797753050348df76473566ee20dca
BLAKE2b-256 7d1dc9a9380a4e8e426831e2b4a5f1e8291ac4c0eef31786ba3ba40c6b079d04

See more details on using hashes here.

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