Simply python library for encrypting private keys using character shuffle method
Project description
key_shuffler
Simply python library for encrypting private keys using character shuffle method.
Supports any blockchains, but is guaranteed to mask only EVM/Aptos private keys.
It checks the correctly entered password by checking the case of the last 2 characters of the key.
Accepts wallets in the format: address:key or key
Installation
pip install key-shuffler
Usage
Encrypt/decrypt key
from key_shuffler import KeyShuffler
a) The password is already set in the variable:
private_key = "........"
passphrase = "Hello world"
shuffler = KeyShuffler(passphrase)
encrypted_key = shuffler.encrypt_private_key(private_key)
decrypted_key = shuffler.decrypt_private_key(encrypted_key)
b) The password will be specified by the user via the terminal:
private_key = "......."
shuffler = KeyShuffler()
encrypted_key = shuffler.encrypt_private_key(private_key)
decrypted_key = shuffler.decrypt_private_key(encrypted_key)
Encrypt/decrypt file
Fast sync/async encrypt: using the context manager:
from key_shuffler import openEncrypted
with openEncrypted(".....", 'r') as file:
...
from key_shuffler import aiofilesOpenEncrypted
async with aiofilesOpenEncrypted(".....", 'r') as file:
...
Default:
shuffler = KeyShuffler()
wallets = shuffler.encrypt_from_file(file_wallets)
wallets = shuffler.decrypt_from_file(file_wallets)
shuffler.encrypt_file_to_file(file_wallets, file_encrypted_wallets)
shuffler.decrypt_file_to_file(file_encrypted_wallets, file_wallets)
Handling an input error
If the password is incorrect, there will be an error and you will be asked to enter it again:
DONATE (EVM CHAINS) - 0xd8dcc73675a36f618fe780049429ec66f8402199
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.