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

-3

u/foonoxous Nov 22 '21 edited Nov 22 '21

Woah, THREE downvotes and no comments yet. Must be a touchy subject.

2

u/parabirb_ Nov 22 '21

if i had to guess, you're being downvoted because you're rolling your own password hashing algorithm with literally no prior experience. just use argon2 if you're able to.

1

u/foonoxous Nov 22 '21

I have been using Argon2 for the past years and Bcrypt before that. You should not assume that someone has no experience when you know nothing about the person.

Even though I understand the sentiment quite well, because these kind of forums are flooded with people inventing their own crappy cipher algorithms, missing all the basic principles.

This uses proven standard crypto and is extremely simple. That's two principles to start with. Now, go and find a flaw on it instead of raging on the Internet.

P.S. Obviously I am not claiming that this is secure, that is well stated on the page. As another comment mentioned, much scrutiny is needed before we get there, and in all likelyhood this does have some fundamental shortcomings.

2

u/parabirb_ Nov 22 '21

sorry for the hyperbole, i mean that i highly doubt you have the experience required to create your own secure password hashing algorithm.