I am trying to verify this hashed password from my /etc/shadow file:
$y$j9T$eia4V8bEUD9QBJAEwilXU.$TLUJexdhrx/q3Nc/YaCrlkVkrxUkimYn3o432pxFr90
I would like to pass the hash to mkpasswd this way but it fails:
$ mkpasswd -m yescrypt secret eia4V8bEUD9QBJAEwilXU.
Wrong salt length: 22 bytes when 0 expected.
$ mkpasswd -m yescrypt secret "$y$j9T$eia4V8bEUD9QBJAEwilXU.$"
crypt: Invalid argument
How can I pass the salt or parameters from the hashed string?
By the way, I have found a way to verify the password with a python script as described in this SO post, so it means we have enough info (parameters and salt) to compute the hash. But I would prefer to do it with mkpasswd:
$ python3 -c 'import crypt, os; print(crypt.crypt("secret", "$y$j9T$eia4V8bEUD9QBJAEwilXU.$"))'
$y$j9T$eia4V8bEUD9QBJAEwilXU.$TLUJexdhrx/q3Nc/YaCrlkVkrxUkimYn3o432pxFr90