Search code examples
hashcryptographyencryption-symmetric

How strong is this hashing technique?


  1. Use AES/Rijndael or any symmetric encryption.

  2. Encrypt the hidden value using itself as the key and a random IV.

  3. Store the ciphertext + IV. Discard everything else.

  4. To check the hash: try to decrypt using provided plaintext. If provided == decrypted, then it's OK.

  5. Ignore ciphertext length problems.

Is this secure?


Solution

  • As described, it has a problem in that it reveals information about the length of the data being hashed. That in itself would be some kind of weakness.

    Secondly ... it is not clear that you would be able to check the hash. It would be necessary to store the randomly generated IV with the hash.

    I was thinking about this while bicycling home, and one other possible issue came to mind. With a typical hashing scheme to store a password, it is best to run the hash a bunch of iterations (e.g., PBKDF2). This makes it much more expensive to run a brute force attack. One possibility to introduce that idea into your scheme might be to repeatedly loop over the encrypted data (e.g., feed back the encrypted block back into itself).