A API for cryptography lib
Project description
Crypto-sim
Crypto_sim/crypto-sim is a Python library for dealing with cryptography(secure encryption and decryption).
Installation
Use the package manager pip to install crypto-sim.
pip install crypto-sim
Usage
To generate a key
from crypto_sim import crypto
crypto.generate_key()
>>> b'KFH1RhgN_JydLaZzAv6QbpQzsET1SQLjjaFz9dR2-To=' #A key will be returned
To save the key in default dir
from crypto_sim import crypto
crypto.save_and_create_key() #A key will be automatically generate and saved
To get the saved key
from crypto_sim import crypto
crypto.get_key()
Note:- this only works when the save_and_create_key() is used
To encrypt a str
from crypto_sim import
key=crypto.generate_key()
plain_message="hi"
encrypted=crypto.encrypt(plain_message,key)
print(encrypted)
Output:-
>>> b'gAAAAABe7uOq4PYOSe9usicMgivc0oVJWaWBzBQmbZbICgrG7TfbdxK8bIuXqttaw-rnScJBGd2RUxgSaC3_CTK0NwbJS_THJA=='
To decrypt
First, we will execute the above code and then we will get the key and the encrypted message After that,
# This full code is after the above code
decrypted=crypto.decrypt(encryption,key)
print(decrypted)
plain_message==decrypted
Output:-
>>> hi
>>> True
Links
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
crypto_sim-0.0.4.tar.gz
(2.4 kB
view hashes)
Built Distribution
Close
Hashes for crypto_sim-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a1a54426efac827b39cb9d65c50d76770954a2abfd1c232ecd9ab6457da2c47 |
|
MD5 | 3a7e6e1224678016792d51844c2dea63 |
|
BLAKE2b-256 | 04fa7c25b1c9ead83ebe9ed493f2fb658feffc3b55a5595ded859cc80cb34e56 |