简体   繁体   中英

custom aes implementation - some files not decrypting properly

I have written an aes cipher in python and it works well with simple text files.

when viewing a ~200k .txt file before and after encryption/decryption through a hex editor the bytes are identical, however there are issues when I try to encrypt/decrypt any other file types (png of similar size for example). The beginning of the decrypted file is the same as the original but there are differences. a single byte will be missing from the decrypted file that was present in the original but the rest is correct.

what is likely to be the cause? if it was down to the algorithm being incorrect then would it not be affecting text files as well?

I worked out what was wrong. I was stupidly removing padding with bytearray.remove() rather than .pop()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM