Skip to main content

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

xcrypt-1.2.0.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

xcrypt-1.2.0-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page