Skip to main content

package for encrypting text and images using Hybrid encryption, asymmetric encryption or symmetric encryption.

Project description

Tienc

Tienc is a simple library that allows you to encrypt and decrypt text and images Hybrid encryption, additionally tienc allow standalone encryption using either AES encryption or RSA encryption. Tienc is based on the Cryptography library. Tienc contains 3 classes, AESEncryption, RSAEncryption and HybridEncryption.

AESEncryption

AES encryption class with two methods: encrypt and decrypt. encrypt takes data as a parameter and returns the ciphertext. Decrypt takes ciphertext as a parameter and returns the decrypted data.

RSAEncryption

RSA encryption class with two methods: encrypt and decrypt. Encrypt takes data as a parameter and returns the ciphertext. Decrypt takes ciphertext as a parameter and returns the decrypted data.

HybridEncryption

Hybrid encryption class with four methods: encrypt_text, decrypt_text, encrypt_image and decrypt_image. Encrypt_text takes text as a parameter and returns the ciphertext and the encrypted key. Decrypt_text takes ciphertext and encrypted key as parameters and returns the decrypted text. Encrypt_image takes image as a parameter and returns the ciphertext and the encrypted key. Decrypt_image takes ciphertext and encrypted key as parameters and returns the decrypted image.

Installation

Use the package manager pip to install Tienc.

pip install Tienc

Usage

hybrid_encryption = HybridEncryption()

# Encrypt text
ciphertext, encrypted_key = hybrid_encryption.encrypt_text("Hello, World!")

# Decrypt text
plaintext = hybrid_encryption.decrypt_text(ciphertext, encrypted_key)
print(plaintext) # "Hello, World!"

# Encrypt image
encrypted_chunks, encrypted_key = hybrid_encryption.encrypt_image("image.jpg")

# Decrypt image
image = hybrid_encryption.decrypt_image(encrypted_chunks, encrypted_key)

It's important to note that the key used in the AESEncryption class is generated randomly every time the class is instantiated, so the key used to encrypt the data must be stored in a secure location, if needed for future decryption.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

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

Tienc-0.0.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

Tienc-0.0.1-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file Tienc-0.0.1.tar.gz.

File metadata

  • Download URL: Tienc-0.0.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for Tienc-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3452e000d9ce4fdab6d4cf732f1de5c385c1d3bd91b12cc56daf10bda40f5c74
MD5 863a4e53b2dfcd39b14feb78e9a94708
BLAKE2b-256 9764aee9d2aea198bc9d6ff067cfb78f552f6812d8e54546ab08111bd46610f7

See more details on using hashes here.

File details

Details for the file Tienc-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: Tienc-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for Tienc-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f1abc5a99316b5d677c34495cae6a57ceacc4dc8d53c902ce0608ad4f1dcb367
MD5 5266026e38fc1aa9e48aa5705c1fa6b0
BLAKE2b-256 aad87a79ef1776b058b502604d3a216dd5ef7f7c975459110848387196886325

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