Skip to main content

Easily encrypt/decrypt data with password

Project description

About

Bytecrypt is a python package for easy data encryption / decryption with password.

Installation

pip install bytecrypt

Usage

Example 1

# main.py

from bytecrypt import *

# byte array
encrypted_data = encrypt_bytes(b"secret", b"password")
decrypted_data = decrypt_bytes(encrypted_data, b"password")

print("\nEncrypted data: " + str(encrypted_data.decode("utf-8")))
print("\nDecrypted data: " + str(decrypted_data.decode("utf-8")))
# output

$ python main.py

Encrypted data: gAAAAABnO7wzHm-WLv-s_fQgHRe_-0Al_CmzUU7XfZcRaRSBXbLy1j8Z97KhiY8nZbaHETyKSO_NuGQH1f73MMs58nrT7pxWJg==

Decrypted data: secret

Example 2 - encrypting / decrypting file contents

# files
encrypt_file("path/to/file/test.docx", b"testPassword")
decrypt_file("path/to/file/test.docx", b"testPassword")

encrypt_file("path/to/file/test.docx", b"testPassword", encrypt_filename=True)
decrypt_file("path/to/file/test.docx", b"testPassword", decrypt_filename=True)

# files in directory
encrypt_directory("path/to/directory", b"testPassword")
decrypt_directory("path/to/directory", b"testPassword")

encrypt_directory("path/to/directory", b"testPassword", encrypt_filename=True)
decrypt_directory("path/to/directory", b"testPassword", decrypt_filename=True)

Example 3 - command line usage

# encrypt file contents
bytecrypt -e -f "test_file.txt" -p "test123"

# decrypt file contents
bytecrypt -d -f "test_file.txt" -p "test123"

# encrypt file name and its contents
bytecrypt -e -f "test_file.txt" -efn -p "test123"

# decrypt file name and its contents
bytecrypt -d -f "EJHF2_1bf...FHJ=" -dfn -p "test123"

# encrypt/decrypt string
bytecrypt -e -str "test_string-1234" -p "test123"
bytecrypt -d -str "tYWHbf_...2dHSL=" -p "test123"

# encrypt/decrypt files in directory
bytecrypt -e -dir "test/directory1" -p "test123"
bytecrypt -d -dir "test/directory1" -p "test123"
bytecrypt -e -dir . -p "test123"
bytecrypt -e -dir . -p -efn "test123"
bytecrypt -d -dir . -p -dfn "test123"

# encrypt all directories inside of a directory (recursive)
bytecrypt -e -dir "test/directory1" -r -p "test123"

Command line arguments:

-e      ;   --encrypt
-d      ;   --decrypt
-f      ;   --file
-dir    ;   --directory
-efn    ;   --encrypt_filename
-dfn    ;   --decrypt_filename
-str    ;   --string
-r      ;   --recursive
-p      ;   --password

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

bytecrypt-0.3.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

bytecrypt-0.3.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file bytecrypt-0.3.1.tar.gz.

File metadata

  • Download URL: bytecrypt-0.3.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for bytecrypt-0.3.1.tar.gz
Algorithm Hash digest
SHA256 a0d027f51dc6342619cd3967cdb84818a265b80c3ef76045ba5cb6cdbcbee533
MD5 d579e52b632cc652ab53b74838011b38
BLAKE2b-256 7c5ccf4ce3677100ea649ef2ea94fd8cf34ddc181a586d1356b88c0fd64953e7

See more details on using hashes here.

File details

Details for the file bytecrypt-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: bytecrypt-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for bytecrypt-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b02740b4f2ce16a1cf235c4b8618ac9d72f5e85930d6ce928a707a18717ccc51
MD5 9988f24b35f5f5a98f41ba53710bf14b
BLAKE2b-256 3da41723a17cea057f20df6dc7fd78bec996596476c7c367f3477e9749bacf70

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