I'm a fan of SHA-512, because the hash remains the same.
I'm currently working on an open source keyboard listener, which takes insecure passwords, like:
- 123456
- qwerty
- password
and secures them, by running them through a hashing algorithm, along with a private salt string unique to the user. Then replaces said insecure password with 20 characters from the hash string. Thus, making any password, secure.
Basically, you'd enter: @/password@/
and it would be replaced by: ajErqAR5fpe76YBnrHtA
I was using SHA512, but was told over at r/cryptography that I needed to switch to Argon2. I noticed that every time I'd use my program, I'd get different results in password fields. This isn't beneficial to login with, as the password must be the same every time it's entered.
I've modified my python code to:
def hash(entered_password, user_salt):
return argon2.low_level.hash_secret(entered_password.encode(), user_salt.encode(), time_cost = 1, memory_cost = 512, parallelism=2, hash_len=20, type=argon2.low_level.Type.D).decode()[-20:]
This has given me the same passwords each time.
A lot of the sites I'm using for reference, say that the values here should be system dependent. I would eventually like to see this in cellphone keyboards. Argon is completely new to me.
My question is: Given my values, would an outputted hash be the same from 2 devices (a phone and a computer)? If not, I need to switch back to SHA512.