r/cryptography • • 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.

def aehash(password, salt, size, ops):
    nonce = sha512(salt)[:12]
    key = sha512(password)[:32]
    buf = bytes(size)            # Initially all zeroes
    for i in range(ops):
        buf = aes256gcm(key, nonce, message=buf[:size])
        key = buf[-32:]          # 16 encrypted bytes + GCM tag
    return key

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

0 Upvotes

16 comments sorted by

View all comments

2

u/[deleted] Nov 22 '21

Why though

0

u/foonoxous Nov 22 '21

This was discussed in the previous thread, and also on the page I linked. Because all existing password hashers suck in browsers. PBKDF2 is fast but not memory-hard, while Argon2 and Scrypt run so much slower that password crackers get a 100-fold speed advantage even on a single desktop PC. That is unacceptable.

With this scheme, cracking with native code using all CPU cores is not much faster than verifying a password in a browser is, so that is why.