2

Assuming you have a salted SHA-512 password hash with 5000 rounds. For example:

{CRYPT}$6$rounds=5000$6835c5dcf0bb7310$hVod/jy7uONMSa.FVpLHb/2OrWpAj3lB/.RWdvgd3YaQAnzN3rorGhaziswwGsHfOWZYkLwXhHKnCy5By2CKr0
  • Could one add more rounds (e.g. another 5000 rounds) to this hashed password without knowing the cleartext password such that the hash value still would be valid if a user's cleartext password is verified?

  • If this is possible as I think it should be, are there existing tools or code to "add more rounds" to this hash value?

Btw. the cleartext password for the above hash is "password" but assume would not know this.

LuHa
  • 31
  • 3
  • 2
    Could you link us to the code or the library that generated this? Generally, if it's really just `$hash=sha512($password + $salt); for i in {1..5000}; do hash=sha512($hash + $salt); done` then it should be fine to just do this another 5000 times. But most recommended algorithms (PBKDF2, Bcrypt, Scrypt, Argon2) do not support this. So it depends on how this was generated exactly. Note that you can always 'wrap' it: you can always apply the operation twice and do 5000 rounds on top of this hashed value. – Luc Jul 05 '19 at 15:22
  • ___DO NOT__ use SHA for password hashing!_ Use `Argon2`, or `bcrypt` if that's unavailable. – undo Jul 05 '19 at 19:09
  • @Luc: you don't need the specific code, [`$6$` is](https://en.wikipedia.org/wiki/Crypt_(C)#SHA2-based_scheme) a [published standard](https://akkadia.org/drepper/SHA-crypt.txt) – dave_thompson_085 Jul 06 '19 at 01:56
  • @luc an d@dave_thompson thanks for the hints. I should have mentioned that the example value is a password from an OpenLDAP record, which uses this format. – LuHa Jul 09 '19 at 07:14
  • @luc: We use PHP's crypt function like this: crypt($cleartextPassword,'$6$rounds=5000$'.$salt.'$'); – LuHa Jul 09 '19 at 07:30
  • 1
    @rahuldottech: Thanks, I know that there are better (more secure) hashing algorithms but in this case our hands were tied because too many third party systems would have needed costly modifications to support bcrypt or similar. – LuHa Jul 09 '19 at 07:30

0 Answers0