Skip to main content

Python tools for encrypt and decrypt

Project description

PyCryptid

PyCryptid is a Python library for encrypt and decrypt object, text, or image

Installation

pip install cryptid

Usage Examples

Cryptid

This class can encrypt most of python object to bytes and decrypt it back to python object (using pickle)

from cryptid import Cryptid

password = 'mykey'
# or generate a new one
password = Cryptid.generate_key()

cryptid = Cryptid(password)

# encrypt and decrypt dict
normal_dict = {'name': 'John Doe', 'age': 20}
enc_dict = cryptid.encrypt(normal_dict)
dec_dict = cryptid.decrypt(enc_dict)

print(enc_dict) # encrypted <class 'bytes'>
print(dec_dict) # {'name': 'John Doe', 'age': 20}

# encrypt and decrypt function
enc_func = cryptid.encrypt(print)
dec_func = cryptid.decrypt(enc_func)

print(enc_func) # encrypted <class 'bytes'>
dec_func('John Doe') # John Doe

Cryptext

Encrypt text using AES

from cryptid import Cryptext

cryptext = Cryptext(password)
text = 'Hello World'
enc_text = cryptext.encrypt(text) # encrypted string
dec_text = cryptext.decrypt(enc_text)
print(dec_text) # Hello World

Steganography

Hide secret message in image

from cryptid import Steganography

st = Steganography()
input_image = '/path/to/image.png'
output_image = 'output.png'
message = 'Hello World'

# encode message to image
st.encode(input_image, message, output_image) # True
# or using password to encrypt the message
st.encode(input_image, message, output_image, password)

# decode message from image
original_message = st.decode('output.png')
# or with password
original_message = st.decode('output.png', password)

print(original_message) # Hello World

AudioSteganography

Hide secret message in audio file

from cryptid import AudioSteganography

ast = AudioSteganography()
input_audio = '/path/to/audio.mp3'
output_audio = 'output.mp3'
message = 'Hello World'

# encode message to audio
ast.encode(input_audio, message, output_audio) # True
# or using password to encrypt the message
ast.encode(input_audio, message, output_audio, password)

# decode message from audio
original_message = ast.decode('output.mp3')
# or with password
original_message = ast.decode('output.mp3', password)

print(original_message) # Hello World

Buy me tanghulu

https://trakteer.id/alfi-syahri

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

cryptid-1.0.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cryptid-1.0.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file cryptid-1.0.1.tar.gz.

File metadata

  • Download URL: cryptid-1.0.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for cryptid-1.0.1.tar.gz
Algorithm Hash digest
SHA256 942a6df732dbc7fe4f5b7999bdcbcc23b16396433c6de06c250ed65766c8a3b2
MD5 0b25632e361f86b6da70fd43df8be0dc
BLAKE2b-256 98c35bae3e8c35097c8fa07a79a5d5229178f76a65cd2c6ccf4e197d7d4bcd66

See more details on using hashes here.

File details

Details for the file cryptid-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: cryptid-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for cryptid-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b637c22a172e1eb920fc948f613f6557f5419b4dac584dd19130639f9e013afa
MD5 fc064a039011e650eb3be110b492621e
BLAKE2b-256 7126ee77f0a6207a395a18e59c3d84007ca69eb5bb67554f00452928c9f715b4

See more details on using hashes here.

Supported by

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