#CryptoLovePoems Expressing love with cryptographic code can be a creative and geeky way to show feelings. Here are some ideas:
1. Encrypted message with secret key (AES-256 in Python)
You can encrypt a romantic message and share it with your partner, who will have to decrypt it with a secret key that only you two know.
from Crypto.Cipher import AES
import base64
# Secret key (must be 16, 24 or 32 bytes)
key = b'YourSuperSecretKey'
# Text to encrypt
message = "I love you with all my heart"
# Make sure the message is a multiple of 16
message += ' ' * (16 - len(message) % 16)
# Encryption
cipher = AES.new(key, AES.MODE_ECB)
ciphertext = base64.b64encode(cipher.encrypt(message.encode()))
print("Encrypted message:", ciphertext.decode())
Then, your partner uses the key to decrypt it and discover the love message.
2. Romantic Hash (SHA-256 of “I Love You”)
If you want something symbolic, you can generate a hash of “I Love You” to prove that your love is immutable.
import hashlib
message = "I Love You"
hash_result = hashlib.sha256(message.encode()).hexdigest()
print("SHA-256 of 'I Love You':", hash_result)
This hash will be unique forever, just like your love.
3. Love in Binary Code
Turn “I Love You” into binary for a geeky twist:
message = "I Love You"
binary = ' '.join(format(ord(c), '08b') for c in message)
print("Message in binary:", binary)
Result:
01001001 00100000 01001100 01101111 01110110 01100101 00100000 01011001 01101111