Reputation: 373
I am working on a python script which encrypts text using 128-AES algorithm but i have a problem:
Picture shows my script processes. This works fine the thing is in the decryption when i give wrong key output decimals goes out of range of ASCII, so program can't show any text at the output.
I expected a wrong text! Is it wrong with code or it should be like that?
Upvotes: 0
Views: 826
Reputation: 4742
That's normal, because AES (and most modern cryptosystems) is dealing with encrypting the actual byte values, not the ASCII values. With an incorrect key, the data won't be decrypted correctly, resulting in ranges outside of the normal ASCII values.
If you're looking for something that encrypts/decrypts ASCII, look into some of the "classic" ciphers: Caesar shift, vigenere, etc.
Upvotes: 1