-
-
Save felnne/b399a0918960696aca5c4324392a72f7 to your computer and use it in GitHub Desktop.
Cryptography Blowfish decryption
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
import base64 | |
from cryptography.hazmat.backends import default_backend | |
from cryptography.hazmat.primitives.ciphers import algorithms, modes, Cipher | |
key = 'xxx' | |
iv = b'12345678' | |
print(type(iv)) | |
inputs = { | |
'issuing authority': 'xxx' | |
} | |
outputs = {} | |
algorithm = algorithms.Blowfish(key) | |
decryptor = Cipher(algorithm, mode=modes.CBC(iv), backend=default_backend()).decryptor() | |
for field, cipher_text in inputs.items(): | |
cipher_text = base64.b64decode(cipher_text) | |
decryptor.update(cipher_text) | |
output = decryptor.finalize() | |
outputs[field] = output.strip() | |
print(outputs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output when run: