Created
September 21, 2018 08:57
-
-
Save nondanee/357264fb8e27ae2b6ecab585fef90ac5 to your computer and use it in GitHub Desktop.
ecb encrypted result
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
# -*- coding: utf-8 -*- | |
from Crypto.Cipher import AES | |
f = open('before.bmp','rb') | |
bid_header = f.read(54) | |
raw_data = f.read() | |
f.close() | |
pad = lambda s: s + (16 - len(s) % 16) * chr(16 - len(s) % 16) | |
cryptor = AES.new('use for ecb test', AES.MODE_ECB) | |
cipher_data = cryptor.encrypt(pad(raw_data)) | |
f = open('after.bmp','wb') | |
f.write(bid_header) | |
f.write(cipher_data) | |
f.close() |
Author
nondanee
commented
Sep 21, 2018
emmm, multimedia course lecturer says .bmp use run length encoding...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment