• caglararli@hotmail.com
  • 05386281520

Storing the hash of the plaintext and the encrypted plaintext next to each other [closed]

Çağlar Arlı      -    10 Views

Storing the hash of the plaintext and the encrypted plaintext next to each other [closed]

I generate a random string of 32 characters and then compute the SHA-512 hash then encrypt the unhashed string. I then save the encrypted text and hash to the database. Is it okay to store the hash of the original text? Will it make the encrypted value less secure? If so, what's the reason behind it?

I have the script on the client side that makes an access token. The token's value is encrypted on the client side, and the private endpoint owner generates a hash for it too. In my database, I only store the encrypted version and the hash. Then, the user who the access token was created for sends a request to a private endpoint with the decrypted access token (which I retrieve from the encrypted form in the database to client side decryption) from their client side. The private endpoint, which is trusted, sends the hash of that access token to my server, and I compare it with the one in my database. If they match, I gain access; otherwise, it's a no-go. So, I don't actually have direct access to the access token itself.