I want to start off by being very clear: I'm not designing a system around this, this is 100% a hypothetical I was toying with.
Is there any harm in using the cryptographic hash of a plaintext as the key? For instance, if my message was Hello, world!
, that produces the SHA256 315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3
. Is there any weakness in using this as a key?
If my system used a pre-determined set of messages, then I can clearly see the attack: hash all the messages, and try them all as keys.
So questions:
- Is there any immediate weakness (assuming the messages I'm sending aren't pre-canned)?
- Is using a nonce enough to overcome any weakness when using AES?
- If not using a nonce, is it still viable?