Picture that you're typing in a input. For each character you add (including special characters, like @ . # ¤ % & ~
and so on), a unique code will generate based on the content. Not a hash! This unique code will only be 20 characters long.
Example
This is just an example
becomesH59S7Y54CI6M7S2XX8A9
This is another example
becomesC77KE95HIAJ7VN582758
Hello! I am a example string!
becomesY8BV572SF8U76RXVB944
This is just an example
becomesH59S7Y54CI6M7S2XX8A9
Why I want this
I am working on a project where the visitors can login to their own accounts (if they have one). As soon as they type in their email address and password, a unique code will generate based on the string (in a hidden input), so the website can identify the user and get the right data from the database.
Why do I want it?
I encrypt everything in the database with 256-bit AES and each user have their own encryption key. To identify the entered email address and password (which is encrypted with the websites encryption key until they login for the first time), this unique code (based on the string) will identify the login. To do the identification of the login with the websites encryption keys is therefore impossible. Hence my question.
This can maybe be a security risk since the unique code will be stored in the databased hashed in MD5 or Whirlpool, but I have no idea of how I can identify the login in another way. If you know a better way, please tell me.
So, how do I accomplish this? Is it even possible to do?
I know how to generate a unique code which is not based on the content (for an example, generating passwords), but I don't know how to generate a code that are unique based on the content.