4
2
In /etc/shadow I have entries such as admin:YtChlvAGYzva2:16318:0:99999:7:::
. I know the original password and would like to generate the same hash somehow. However, running openssl passwd -crypt password
gives me different results every time I run it. I assume salt is involved, so where can I find the salt used to create the original hash?
Edit: I got the original hash using the following command:
openssl passwd -crypt -salt Yu password
Can I separate them somehow? – JohnEye – 2014-10-06T20:03:41.103
1@JohnEye Use the substring methods of your favorite script/language? – schroeder – 2014-10-06T20:09:27.470
Thank you, I was able to get the original hash using
openssl passwd -crypt -salt Yu password
. – JohnEye – 2014-10-06T20:09:56.130@schroeder: I asked this before OP changed the post :-) – JohnEye – 2014-10-06T20:10:35.613
1And... what was the salt? First two characters (Yt) of the hash as stated by gowenfawr? – Aydin K. – 2016-08-30T08:26:36.533
Aside from
openssl
, the following python one-liner will also do:python -c 'import crypt;print(crypt.crypt("toor","X0"))'
whereX0
is the salt. – typelogic – 2019-02-09T16:04:40.177