A module for encryption and information security operations.
Project description
Contents
better-cryptography
contains Python scripts for implementing various encryption methods (currently supports Blowfish and AES file encryption and RSA string encryption) and various logging needs.
FAQ
How do I install and import the package?
Install through the pip3 install better-cryptography
command. Import via import better_cryptography
or from better_cryptography import ...
How do I report a bug?
Email me at w.garrioch456@gmail.com.
Syntax
-
Ciphers Class methods
-
hash(StringToHash)
Takes a string and returns a hex-encoded SHA 256 hash.
-
change_encrypting_password(old_password, new_password)
Takes 2 arguements,
old_password
andnew_password
, and changes the class'spassword
attribute. -
sec_delete(random_fill, null_fill, passes)
Takes 3 arguements and securely overwrites and deletes the file. Should be done in conjunction with another secure file deletion protocol. Will not delete files that are not in the
/home/
folder or files that are hidden.-
random_fill -> bool
This variable controls random overwrites of the file. Default is True.
-
null_fill -> bool
This variable controls null overwrites of the file. Default is True.
-
passes -> int
This variable controls the amount of times overwrites occur. Default is 35.
-
-
delete(path)
Takes an arguement
path
and deletes the file. Will not delete files not in the/home/
folder or files that are hidden. -
RSA Methods
-
generate_RSA_keys()
Returns a RSA key pair in a tuple
(public_key, private_key)
-
RSA_encrypt_str(public_key, string)
Takes 2 arguements, a
public key
and the string to be encrypted. Returns the encrypted string. -
RSA_decrypt_str(private_key, encrypted_str)
Takes 2 arguements, a
private key
and an encrypted string. Returns a decrypted string.
-
-
AES Methods
-
generate_symmetric_key(salt)
Takes a single argument,
salt
, and returns a symmetric encryption key. Ifsalt
is not provided, the method generates a random salt and returns a tuple(key, salt)
. -
AESencrypt_file(path)
Takes a file path and encrypts with AES using a key generated with a random salt and the class
password
attribute. Will not encrypt if the file is already encrypted. -
AESdecrypt_file(path)
Takes a file path and decrypts it using the class
password
attribute and the salt written to the file. Will not decrypt if the file was encrypted with a different encryption algorithm, different key, or was already decrypted.
-
-
Blowfish Methods
-
BLOencrypt_file(path)
Takes a file path and encrypts it using the Blowfish algorithm. Will not encrypt if file is already encrypted.
-
BLOdecrypt_file(path)
Takes a file path and decrypts it using the Blowfish algorithm. Will not decrypt if the file was encrypted with a different encryption alogrithm, different key, or if the file was already decrypted.
-
-
-
Log Class Methods
log_exists()
Checks to see if a
log.log
file exists for the current user. Returns a boolean value.create_log()
Creates a
log.log
file for the current user.audit(keywords)
Takes a list of keywords and removes lines in the current
log.log
file that contain those keywords.log(logstring)
Takes a string to log into the
log.log
file and writes it.change_user(new_user)
Changes the class atrribute
username
to thenew_user
parameter.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for better cryptography-0.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | aacda613fc55c0d1cdaa51fe707342cf9a21a6e42ba646181f8c8ccdb8a32436 |
|
MD5 | 686ebfebc9f98ccf18a6fe8ba0235be8 |
|
BLAKE2b-256 | 1dbb733f8aeccb197c106608b96ae46dbba80aa70445a1f861b141460aeb497a |
Hashes for better_cryptography-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92bedfc81818e0b2757f1a42e4cd6b5b3ba514f5a698c44e2baf334dcb8e67ff |
|
MD5 | 5e4f2f797828708cef679f78d25599d1 |
|
BLAKE2b-256 | 388817a8d9745f9b9ab4446bc47ce269ddbf19219aa9d9874cb2ff7c6617053c |