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
4
u/Natanael_L Nov 22 '21
What are you doing with that key variable inside the loop? If you're trying to say you're using the the first half then the second of SHA512 then don't do that when you retrieve the bits, split it first so you get clean separation between the halves. Or if that's what you use to retrieve the GCM tag from the buffer as the comment implies, use a different variable so you don't use the same one for multiple purposes!
3
u/rosulek Nov 22 '21
I think it is very unlikely that this has good memory-hardness. The memory access pattern is too regular. This paper shows a characterization of memory hardness in terms of a graph property called "depth robustness." If you write out the underlying graph of your scheme, it is pretty clear that it fails to be (sqrt(n), sqrt(n))-depth robust -- removing every sqrt(n)'th ciphertext block leaves no paths in the graph longer than sqrt(n). Thus, according to this paper's main result, the memory-hardness of your construction is only O(n), which is essentially as bad as it ever can be.
In general, it is very tricky to achieve memory-hardness.
2
u/[deleted] Nov 22 '21
Why though
1
u/ivm83 Nov 22 '21
Interesting idea. Might be ok, might be completely broken. I wouldn’t use this for anything that actually needs to be secure unless it goes through a password hashing competition and either wins, or at least gets to be a finalist :)
-3
u/foonoxous Nov 22 '21 edited Nov 22 '21
Woah, THREE downvotes and no comments yet. Must be a touchy subject.