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()
# this is the output
>>> 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 crypto
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
Metadata
Release files for crypto-sim 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| crypto_sim-0.0.5.tar.gz | 2.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| crypto_sim-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.1 kB
Release files / crypto_sim-0.0.5.tar.gz
| Download URL | crypto_sim-0.0.5.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0828a69efa3797cfca9e37201c94d3e36eff25729bd5421bb041cf3b60a815c
|
|
BLAKE2b-256 checksum How to use checksums |
02f6c03889cf4529325cc69a4ad45b487e630fef3791df23a320e250c6a119d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / crypto_sim-0.0.5-py3-none-any.whl
| Download URL | crypto_sim-0.0.5-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e4fa9da12e562599df253ae30371e3bfdee84ab4afd0d8f668f337dc4a49493
|
|
BLAKE2b-256 checksum How to use checksums |
2dc36d07ddb5d1c3c3c743efaef9f05fa0ea0eb02913b0790430ae8b5d31f4d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|