A Python encryption library.
Project description
XCrypt
About
This was initially a project to prove that I could make a strong encryption but I decided to publish it so that the internet people could improve it and use it. While it is still kinda basic it will get stronger and more efficient hopefully.
To Use
To install XCrypt use the following command pip install xcrypt
or python -m pip install xcrypt
. After you install it be sure to import it with:
import xcrypt
Now you can start to actually use XCrypt. XCrypt is a key file based encryption, so the first step in using it is to obtain a key. You can have someone else give you a key or you can generate one yourself. If you want to generate a key you can use the xcrypt.make_key()
function. The return value of this function is equal to the key name (as a string). You will need this to encrypt and decrypt information.
import xcrypt
print("Generating key")
keyName = xcrypt.make_key()
print("Key Name is " + keyName)
Now that you have a key file generated, the next step is to encrypt some information, the encrypted information must be a string. If it isn't a string it should be automatically converted. If you want to encrypt information the function you would use is xcrypt.encrypt(keyName, Data)
. This function takes the key name (required for correct encryption) and the data/message to encrypt.
import xcrypt
keyName = xcrypt.make_key()
encryptedData = xcrypt.encrypt(keyName, "Hello World!")
print(encryptedData) # This should output to a bunch of random characters.
After you have some information encrypted you probably want to decrypt it. The easiest and only way to do that is through the xcrypt.decrypt(keyName, Data)
function. It takes two variables, keyName (for the key file name, same as the encryption function) and data (the encrypted text seen in variable encryptedData
previously).
import xcrpyt
keyName = "<Your Key File Name>"
encryptedData = "<Data Returned From Encrypt Function>"
decryptedData = xcrypt.decrypt(keyName, encryptedData)
print(decryptedData) # If everything worked then this should be "Hello World!".
Alright, now that we know exactly how to do everything lets put it together into one new file and test it. Each line will be commented explaining its purpose.
import xcrypt # Import xcrypt so we can use the functions.
keyName = xcrypt.make_key() # Generate a key file and save the name to a variable.
initialData = input("Message To Encrypt/Decrypt: ") # Allow a user imputed message.
encryptedData = xcrypt.encrypt(keyName, initialData) # Save encrypted message to variable.
decryptedData = xcrypt.decrypt(keyName, encryptedData) # Save decrypted message to variable.
print("Message: " + initialData) # Display the initial message submitted.
print("Encrypted: " + encryptedData) # Display the encrypted form of the message.
print("Decrypted: " + decryptedData) # Display the decrypted form of the message.
Your finished! You have made a program that uses xcrypt to encrypt and decrypt messages.
A more rough example can be seen in the example.py
file.
If There Are Issues
The only library it requires is random and that comes with python.
Make sure your using the right key file when encrypting and decrypting.
Make sure that your python version is compatable with XCrypt.
If you would like to report and issue please do so by one of the following methods:
- Making a GitHub issue.
- Joining my Discord server.
- Emailing me.
Copyright (c) 2021 kgsensei.
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
Built Distribution
File details
Details for the file xcrypt-1.2.0.tar.gz
.
File metadata
- Download URL: xcrypt-1.2.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4172682fea9ea6ec671de11b48a365fdc20e9ae3a8438173a87e7254af3b25db |
|
MD5 | 35a60fa56468f4a19d044882253c7586 |
|
BLAKE2b-256 | b55a42b9842bbcf85b99058aa011d1f60cc9dd63a79859e990e5d2fe1bf61c90 |
File details
Details for the file xcrypt-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: xcrypt-1.2.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4682a6370cafd23acaf7a83f8bf139d42867154ae5c9007e62d92c3b90b69a2a |
|
MD5 | 764622fbadb2791aca9a6deeb610d60f |
|
BLAKE2b-256 | 679ce6920ba174e7ad2b4de9cbea3788ad51ae75270642523bad5977f25dea2c |