Skip to content
/ hiss Public

encryption of messages and files via ecies & Ethereum public & private keys, plus deriving public keys via txns & looking them up with infura and etherscan

Notifications You must be signed in to change notification settings

mewmix/hiss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# README

This repository contains Python script kiddy funcs for various Ethereum-related ECIES tools, including recovering public keys from transactions, encrypting and decrypting messages, and more.

Credit to the original author of the public key from transaction hash dev in this linked issue -

You can install these dependencies using the following command:

git clone https://github.com/mewmix/hiss

pip install -r requirements.txt


And then to run the GUI

python hiss-gui.py

#SCREENSHOTS

#MACOS

1

#WINDOWS Screen Shot 2023-08-31 at 9 05 42 PM

Recover Public Key from Private Key

You can recover the public key corresponding to a given private key using the provided function:

private_key = 'YOUR_PRIVATE_KEY_HERE'
recovered_public_key = recover_public_key_from_private(private_key)
print("Recovered Public Key:", recovered_public_key)

Encrypt and Decrypt Messages

Encrypting and decrypting messages using ECIES is demonstrated in the following example:

private_key = 'YOUR_PRIVATE_KEY_HERE'
message = 'Hello, ECIES!'

# Recover public key from private key
recovered_public_key = recover_public_key_from_private(private_key)

# Encrypt the message
encrypted_data = encrypt_with_public_key(recovered_public_key, message)

# Decrypt the message
decrypted_message = decrypt_with_private_key(private_key, encrypted_data)

print("Encrypted:", encrypted_data.hex())
print("Decrypted:", decrypted_message)

Recover Public Key and From Address from Transaction

To recover the public key and "from" address of a transaction, use the pubkey_txn function:

provider = 'YOUR_ETHEREUM_PROVIDER_URL'
tx_hash = 'YOUR_TRANSACTION_HASH_HERE'

recovered_public_key, from_address = pubkey_txn(provider, tx_hash)
print("Recovered Public Key:", recovered_public_key.to_hex())
print("From Address:", from_address)

Encrypt and Decrypt Files

Encrypting and decrypting files using ECIES is demonstrated in the provided functions:

public_key_hex = 'RECIPIENT_PUBLIC_KEY_HEX'
input_file_path = 'path/to/input/file'
output_file_path = 'path/to/output/file'

# Encrypt a file
encrypt_file(public_key_hex, input_file_path, output_file_path)

private_key_hex = 'YOUR_PRIVATE_KEY_HEX'

# Decrypt a file
decrypt_file(private_key_hex, input_file_path, output_file_path)

Finding Latest Transaction Hash for Address

To find the latest transaction hash for a specific Ethereum address, use the latest_hash function:

provider = 'YOUR_ETHEREUM_PROVIDER_URL'
address = 'TARGET_ETHEREUM_ADDRESS'

latest_tx_hash = latest_hash(provider, address)
if latest_tx_hash:
    print(f"Latest Transaction Hash for {address}: {latest_tx_hash}")
else:
    print(f"No transactions found for {address}.")

Note

  • Make sure to replace placeholders like 'YOUR_PRIVATE_KEY_HERE', 'RECIPIENT_PUBLIC_KEY_HEX', 'YOUR_TRANSACTION_HASH_HERE', 'YOUR_ETHEREUM_PROVIDER_URL', and 'TARGET_ETHEREUM_ADDRESS' with actual values.
  • This code is intended for educational and informational purposes.

Feel free to customize the instructions and explanations as needed. Remember to replace the placeholders with actual values and adapt the document to your repository's structure and context.

About

encryption of messages and files via ecies & Ethereum public & private keys, plus deriving public keys via txns & looking them up with infura and etherscan

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages