/sample.py Secret
Created
February 6, 2023 14:04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Sample example program with PyCrypto | |
# Import the necessary modules | |
import Crypto | |
from Crypto.Cipher import AES | |
# Create a 16 byte key | |
key = '0123456789abcdef' | |
# Create a cipher object using the key | |
cipher = AES.new(key) | |
# Create a plaintext message | |
plaintext = 'This is a secret message!' | |
# Encrypt the plaintext | |
ciphertext = cipher.encrypt(plaintext) | |
# Print the ciphertext | |
print(ciphertext) | |
# Decrypt the ciphertext | |
decrypted = cipher.decrypt(ciphertext) | |
# Print the decrypted message | |
print(decrypted) | |
#Sample example program with PyWallet | |
#This example program uses PyWallet to create a new Bitcoin wallet. | |
#Import the PyWallet library | |
import pywallet | |
#Create a new wallet | |
wallet = pywallet.Wallet() | |
#Generate a new address | |
address = wallet.generate_address() | |
#Print the address | |
print(address) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment