We want to design a symmetric encryption scheme. Note that the following things are true for our system:
- The plaintext P will change every time for a given user.
- A user will choose a password which may remain same for their lifetime
- A 256-bit key K is derived by hashing the user's password(using SHA256).
- We will need to encrypt plaintexts multiple times. However, it is guaranteed that each time, the plaintext will be different
- Plaintext is guaranteed to be 256-bit.
- Plaintext will be generated internally in the system and no one can access it.
- Ciphertext will be in public domain. So a user in possession of password can derive plaintext.
If we use XOR-Cipher (C = P ^ K
and P = C ^ K
), is this system secure. Our alternative is to use AES or chacha20-poly1305. Will any of those offer any advantage over the XOR-Cipher scheme?
PS. We'll be using checksum(SHA of plaintext) in the xor-based system for integrity (as chacha-poly has MAC).