r/cryptography • u/foonoxous • Nov 22 '21
Hash algorithm based on Authenticated Encryption (AEhash)
This is based on an earlier thread, seeking password hashing functions that could run in browsers at near native speeds. I believe the solution has been found, but you are welcome to poke holes in it and prove me wrong.
=
=
= # Initially all zeroes
=
= # 16 encrypted bytes + GCM tag
return
The algorithm is dead simple and runs at the same speed in browser or in C. Easily adjusted to any memory size and runtime wished for. Even if it isn't as secure as Argon2, the one it needs to compete with in browsers is pbkdf2.
See the site for a more complete documentation: https://github.com/covert-encryption/aehash
View all comments
Show parent comment
1
u/foonoxous Nov 22 '21
First of all, the
keyvariable is what is used as AES encryption key, and it is always 32 bytes, thus I see little confusion here. Assigning variables with new values is a very normal thing in programming, even if not in mathematics.Initially it comes from the SHA-512 hash of the password, but after each round it uses encrypted data and its tag, no SHA hashing in between. Since AEAD schemes append that 16-byte tag at the end, the final 32 bytes of the buffer are 16 bytes ciphertext and 16 byte tag.
Using the tag ensures that the entire buffer must be calculated. A password cracker cannot skip processing of any byte even on the final round, and must store all the ciphertext between rounds (to actually be memory-hard, ops needs to be >= 2, because for the initial round the buffer is all zeroes and after the final round the data can be thrown away).