Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

therealOri/oCrypt0r

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


oCrypt0r - A minimalistic, simple AES encryption library written in python3.

oCrypt0r allows you to encrypt and decrypt strings of text via AES. Your encrypted data/strings can only be decrypted using your own custom key and salt you set before encrypting said data. You can use this for a variety of things from securing passwords to securing communication to encrypting HWIDs and directories/folders. Making AES encryption a little bit easier!



Updates

What has been updated as of | 7/17/22:

  • Encryption functions now take 3 args instead of 4.
  • Removed the hashing feature that makes a blake2b hash of a key to be used in the encryption. This basically made things less unique as the hash was just all 0-9 and lowercase a-z characters.


Installation

[Directly from here/this repo.]

[therealOri ~]$ pip install git+https://github.com/therealOri/oCrypt0r

or

[From Pypi.]

[therealOri ~]$ pip install oCrypt0r



Code Examples

If you would like to make this look better/more presentable. Please by all means make a pull request xD. I'm not the best with making things look great.

It is important to know that all functions will take 3 values. 2 for the making of the encryption key, and 1 for what you want encrypted/decrypted.

The encryption takes 2 values to make a key. The key then gets plugged into the AES encryption as a cipher. All of that will be used to encrypt whatever you want as a value. "strings", "files", or "directories/folders". (inclusing sub-directories)

You can read more about what the arguments do in the documentation.

from ocryptor import oCrypt
oCr = oCrypt()


##---------Strings---------##

#Encrypting Strings
string = 'Hello Wolrd <3'
enc_key = "abcdefgHIJKLMNOP~!@#$%^&*"
enc_salt = 'qrstuvwxyz1234567890'

str_enc = oCr.string_encrypt(string, enc_key, enc_salt)
oCr.clear()
print(str_enc) # Output is b64 encoded. => VpqFynzUPOK3dHYaCFO57IGlYrQRyzt2NvmzMEN2+AA=



#Decrypting Strings
string = 'VpqFynzUPOK3dHYaCFO57IGlYrQRyzt2NvmzMEN2+AA='
enc_key = "abcdefgHIJKLMNOP~!@#$%^&*"
enc_salt = 'qrstuvwxyz1234567890'

str_dcr = oCr.string_decrypt(string, enc_key, enc_salt)
oCr.clear()
print(str_dcr) # Output is "Hello Wolrd <3"

##---------Strings End---------##







##---------Files---------##

#Encrypting Files
file_path = '/home/therealOri/Projects/example.txt'
enc_key = "abcdefgHIJKLMNOP~!@#$%^&*"
enc_salt = 'qrstuvwxyz1234567890'

oCr.file_encrypt(file_path, enc_key, enc_salt)



#Decrypting Files
file_path = '/home/therealOri/Projects/example.txt.oCrypted' # .oCrypted is what is used to let you know that the file is encrypted.
enc_key = "abcdefgHIJKLMNOP~!@#$%^&*"
enc_salt = 'qrstuvwxyz1234567890'

oCr.file_decrypt(file_path, enc_key, enc_salt)

##---------Files End---------##







##---------Directories---------##

#Encrypting Directory
dir_path = '/home/therealOri/Projects' #Must be a path to the directory you want to encrypt.
enc_key = "abcdefgHIJKLMNOP~!@#$%^&*"
enc_salt = 'qrstuvwxyz1234567890'

oCr.dir_encrypt(dir_path, enc_key, enc_salt)



#Decrypting Directory
dir_path = '/home/therealOri/Projects'
enc_key = "abcdefgHIJKLMNOP~!@#$%^&*"
enc_salt = 'qrstuvwxyz1234567890'

oCr.dir_decrypt(dir_path, enc_key, enc_salt)

##---------Directories End---------##



Disclaimer

I am not liable or responsible for any data loss or destruction of any kind of data perpetrated by bad actors using my code/package/functions. This also extends to losing your own data while using oCrypt0r. If you lose data and do not have backups then that is solely on you and I am not liable or responible for any loss of data you may have occured.

This disclaimer mainly comes from me noticing that not all files can be encrypted and decrypted without corruption, like video files like .mkv or zip files and archives for example. I haven't really found a way to do that safely yet. So remember to be careful of what you encrypt and make sure to have plenty of backups.



Support | Buy me a coffee <3

Donate to me here:

image