https://github.com/cbedroid/tezcrypt
Python File Encryption program that encrypt and decrypt your files using AES encryption algorithms. Completely-Secure-Files
https://github.com/cbedroid/tezcrypt
Last synced: 6 months ago
JSON representation
Python File Encryption program that encrypt and decrypt your files using AES encryption algorithms. Completely-Secure-Files
- Host: GitHub
- URL: https://github.com/cbedroid/tezcrypt
- Owner: cbedroid
- License: lgpl-2.1
- Created: 2019-10-04T13:16:04.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-03-15T04:26:26.000Z (almost 5 years ago)
- Last Synced: 2025-01-27T10:28:56.439Z (12 months ago)
- Language: Python
- Size: 47.9 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
TezCrypt
===========
Tezcrypt is an AES encryption python program that can encrypt or decrypt files and folders. It can be used in python or as a cmdline program.
TezCrypt support python3+ and is compatible with windows and linux system.
# How to use
First we import the module:
```python
from tezcrypt import Encryptor
```
# Python
## Key
A password key is required to use this program.
Key must be 8 to 24 characters long
- password are case sensitive.
- Symbols and numbers are supported
- 8 to 24 characters long ( cmdline only)
## Initialize
```python
mykey = "secretkey"
crypt = Encryptor(key=mykey)
```
Once initialized, method `encrypt()` or `decrypt()` can be called with parameters 'infile' , 'outfile',and 'alter'.
The `infile` argument is the name of the file you want to decrypt or encrypt. It must be called (required). The `outfile` argument is optional.It is the name of the file you want save the results. `alter` is also optional, alter argument decrypt or encrypt file name. There are 3 option to pass to alter: 'decrypt','encrypt', False. It is set to False by default.
#### Warning: If the outfile is Not supplied, the infile will be overwritten!
- infile - input file to encrypt or decrypt
- outfile - output file to save the results
- alter - encrypt or decrypt file name
```python
from tezcrypt import Encryptor
mykey = "secretkey"
crypt = Encryptor(key=mykey)
#Example : 1
your_file = "important.txt"
crypt.encrypt(infile=your_file)
#infile will be overwritten
#Example : 2
your_file = "important.txt"
newfile = "important_encrypted.txt"
crypt.encrypt(infile=your_file, outfile=newfile)
#infile not overwritten, newfile will be created
#Example : 3
your_file = "important.txt"
crypt.encrypt(infile=your_file ,alter='encrypt')
#result: infile --> 437CE4CEBDF566845E60A9C00FD926C4
#"important.txt" overwritten to filename "437CE4CEBDF566845E60A9C00FD926C4"
#Example : 4
your_file = '437CE4CEBDF566845E60A9C00FD926C4'
crypt.decrypt(infile=infile,alter='decrypt')
#result: 'important.txt'
# "filename "437CE4CEBDF566845E60A9C00FD926C4" is converted back to "important.txt"
```
# Cmdline
TezCrypt can also be used as a cmdline program.
For linux distribution, Use **tezcrypt** bash file instead of **tezcrypt.py**.
## cmdline argument
```
usage: tezcrypt.py [-h] [-o OUTFILE] [-k KEY] [-f] [-a] (-e | -d) infile
positional arguments:
infile Input file
optional arguments:
-h, --help show this help message and exit
-o OUTFILE, --outfile OUTFILE
Output file
-k KEY, --key KEY key for encryption and decryption
-f, --folder Full folder Encrypt/Decrypt
-a, --alter Encrypt/Decrypt file name
-e, --encrypt Encrypt file
-d, --decrypt Decrypt file
```
## cmdline usage
```bash
FOR PRIVACY
# Avoid using argument "-k --key" to protect secret password from others!
# If argument "-k" is not passed, then the user will be prompt to enter password.
#To encrypt (Warning! filename will be overwritten)
$ tezcrypt -e -k
#To decrypt (overwrite infile)
$ tezcrypt -d -k
#To encrypt and save to another file
$ tezcrypt -e -o -k
#To decrypt and save to another file
$ tezcrypt -d -o -k
#To encrypt file content and filename (Warning! filename will be overwritten)
$ tezcrypt -e -a -k
#To decrypt file content and filename (overwrite infile, and convert filename back to original name)
$ tezcrypt -d -a -k
```