For some project, I need to store some short string in encrypted form. It would be ideal for the current purposes to encrypt it using itself.
# This would be the usual way:
result = AES_ENCRYPT(string, key)
# but I would like to do it this way:
result = AES_ENCRYPT(string, string)
The same string itself would be used as the key!
The 'string' is always some short text, like 20 characters of letters and numbers. This solution seems better to me than using any hash function, since hash could lead to collisions - different strings could potentially produce the same result, which is low probability, I know, but still not zero so I want to avoid that.
My question is, is my approach safe? Encoding the data using the data itself, does it lead to any security issue? Would it mean that it could be easier to decrypt the result, if the 'attacker' knows the fact it is produced by encrypting my way? Thank you.