Skip to main content

A package for encrypting files with a password.

Project description

Description

pydlock is a simple Python package for encrypting and decrypting files. It can be used either as a package imported into other Python modules or as a command line script.

Installation

pydlock is available on the Python Package Index (PyPI) at https://pypi.org/project/pydlock. To install pydlock, simply use the Python pip installer:

pip install pydlock

Usage

From the command line

To access the help method of the script, use python -m pydlock -h:

user@computer:~$ python -m pydlock -h
usage: __main__.py [-h] [--arguments ARGUMENTS] [--encoding ENCODING]
                   {lock,unlock,python,run} file

positional arguments:
    {lock,unlock,python,run}
    file

optional arguments:
    -h, --help            show this help message and exit
    --arguments ARGUMENTS
    --encoding ENCODING

To encrypt a file, use python -m pydlock lock [file]:

user@computer:~$ cat secret.txt
Shh! It's a secret!

user@computer:~$ python -m pydlock lock secret.txt
Enter password:
Re-enter password:

user@computer:~$ cat secret.txt
gAAAAABeqx971nHtXHi4dJYw8A_m_1mRYT8V2Sy4XPLqdg0t4mp9ooN-aTU1fuPQwEpwnuFiAfbJ6oPaN9IB1gzFT5-Tb4gFXQMw5uQUXDYV2Pvso6E5lXQ=

To decrypt a file, use python -m pydlock unlock [file]:

user@computer:~$ cat secret.txt
gAAAAABeqx971nHtXHi4dJYw8A_m_1mRYT8V2Sy4XPLqdg0t4mp9ooN-aTU1fuPQwEpwnuFiAfbJ6oPaN9IB1gzFT5-Tb4gFXQMw5uQUXDYV2Pvso6E5lXQ=

user@computer:~$ python -m pydlock unlock secret.txt
Enter password:

user@computer:~$ cat secret.txt
Shh! It's a secret!

To run an encrypted Python file, use python -m pydlock python [file]:

user@computer:~$ cat hello_world.py
print("Hello world!")

user@computer:~$ python -m pydlock lock hello_world.py
Enter password:
Re-enter password:

user@computer:~$ cat hello_world.py
gAAAAABeq6fM4Qxm0TB9cGIg6G-uNprWIAyPmuciugNGIvPxudmBgkIWGhlV3Lg7RyMRdUVODRCehxWXnS5zhSm6fDZ0Ct57XYPztYi_9DZHp0sO1rXuyCE=

user@computer:~$ python -m pydlock python hello_world.py
Enter password:
Hello world!

user@computer:~$ cat hello_world.py
gAAAAABeq6fM4Qxm0TB9cGIg6G-uNprWIAyPmuciugNGIvPxudmBgkIWGhlV3Lg7RyMRdUVODRCehxWXnS5zhSm6fDZ0Ct57XYPztYi_9DZHp0sO1rXuyCE=

In other Python modules

import pydlock

filename = "secret.txt"

with open(filename, "w+") as file:

    print("Shh! It's a secret!", file = file)

pydlock.lock(filename)

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

pydlock-1.2.0.15.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

pydlock-1.2.0.15-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file pydlock-1.2.0.15.tar.gz.

File metadata

  • Download URL: pydlock-1.2.0.15.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for pydlock-1.2.0.15.tar.gz
Algorithm Hash digest
SHA256 8acde374b151d346e05f966f4898ae8f5356a4812a0e66acc1cd2f55e6119407
MD5 f498bc14f1c8ac04dd4b4f7d82cb50fd
BLAKE2b-256 ec39d554c463e6e213e092e15af1287dc260743c5c9fade2b9639c9e5a726e38

See more details on using hashes here.

File details

Details for the file pydlock-1.2.0.15-py3-none-any.whl.

File metadata

  • Download URL: pydlock-1.2.0.15-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for pydlock-1.2.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 7594648afa24979836707e2f8ff8fdd50bbf51c1eddf2201cc5238e98815b612
MD5 40e1f03f0e9cc378b9bc800e50b7d63f
BLAKE2b-256 fc772ae2e7167887c9261a9b2afd1e59f29aff32855e85c2774b0af3841eb35e

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