Skip to main content

Simple encryption and decryption by chunk

Project description

This is a simple script for encrypting and decryption file by chunk using cryptography package, decryption includes download from url. Project repository url is not yet available, mostly because of its inactive development status.

Encrypting files:

from chunkcrypt.cryptchunk import encrypt_file
# encrypt_file(key, file, output_file, chunk_size)

# encrypting without a provided key
encrypt_file(None, '/home/user/myfile.txt', '/home/user/encryfile.txt')
# "myfile.txt" is now encrypted and the encrypted file is located at "/home/user/encrytfile.txt"

# encrypting with a provided key
encrypt_file('CemuWNzkXti7OVAmFV0SIpZAxkF2wybK', '/home/user/myfile.txt', '/home/user/encrytfile.txt')

# specifying a chunksize, default is 1024
encrypt_file(None, '/home/user/myfile.txt', '/home/user/encryfile.txt', 2048)
# the length of bytes of a encrypted chunk is also written on the encrypted file on a 4 element array of bytes format
# this is needed since Fernet returns additional bytes whenever it encrypted data

Decrypting files:

from chunkcrypt.cryptchunk import decrypt_file, downl_decrypt
# decrypt_file(key, encrypted_file, output_file)
# downl_decrypt(url, output_file, key, silent=True,  pre='', suff='', msg_v='')
# decryption can also be done on file encrypted using encrypt_file()

# decrypting a file
decrypt_file('CemuWNzkXti7OVAmFV0SIpZAxkF2wybK', '/home/user/encrytfile.txt', '/home/user/decryptfile.txt')

# decrypting from url, only works on direct download link or hotlink
downl_decrypt('https://sampledownl.com/download/encryptedfile.txt', '/home/user/decryptfile.txt', 'CemuWNzkXti7OVAmFV0SIpZAxkF2wybK')

# decrypting from url, with message
downl_decrypt(
    'https://sampledownl.com/download/encryptedfile.txt', 
    '/home/user/decryptfile.txt', 
    'CemuWNzkXti7OVAmFV0SIpZAxkF2wybK',
    False,
    ' * ',
    ' - Test',
    'MyFile'
)
# Output:
#  * Attempting to Download MyFile - Test
#  * Finished Downloading MyFile - Test
#  * Attempting to Decrypt Downloaded MyFile. Please wait, this might take a while depending on the size of file - Test
#  * Finished decrypting MyFile - Test

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

chunkcrypt-0.0.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

chunkcrypt-0.0.3-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file chunkcrypt-0.0.3.tar.gz.

File metadata

  • Download URL: chunkcrypt-0.0.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for chunkcrypt-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a8d942c3fa324cb68ff561a0cc8512e37499b0c79dd4f9888977547e79b105a7
MD5 b2c219237f9ce56036e058a45913dedd
BLAKE2b-256 71206abf32362875097a8e5ff71c20015c959fab20b31383266ee1aa36190c39

See more details on using hashes here.

File details

Details for the file chunkcrypt-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: chunkcrypt-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for chunkcrypt-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 22c8cd8617d762aa78dd1947db5fdacd2240905072c21caadd7f742bf56951ee
MD5 b58158618f9696629cdcbfd90e2ea22a
BLAKE2b-256 1747e4929c813e3d8ddad97679030f04397597da0032f94fd2c3192eff7a1740

See more details on using hashes here.

Supported by

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