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.2.tar.gz (2.9 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.2-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: Tienc-0.0.2.tar.gz
  • Upload date:
  • Size: 2.9 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.2.tar.gz
Algorithm Hash digest
SHA256 76b4fa62f3c3d121447101a4b717e5c38e66515fc590216725e4b4558a470594
MD5 762104f812b7c85b16a62dc9b2299cd5
BLAKE2b-256 3d1f0a0a273f5dc72af841af6b803df434c035f71ddc8d9aa35e2e6ebe9460ce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: Tienc-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 2.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fe9ca35fb9ea906eddeded14c51f1fd3dea88b71e0da6a919d1a1d887d33852f
MD5 a4bc81d47d201d2fe950c1dc03987f52
BLAKE2b-256 0daf16b8dde5f0d1ed048ff0f9bdce26609628d9a98f710471f37a2cee771f93

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