From Omnia
Jump to navigation Jump to search

The /etc/shadow password format is set to $id$salt$hashed, The $id is the algorithm used On GNU/Linux as follows:

$1$ is MD5
$2a$ is Blowfish
$2y$ is Blowfish
$5$ is SHA-256
$6$ is SHA-512

Install mkpasswd:

sudo apt install whois


mkpasswd -m [algorithm] [password] [salt]

If you don't specify a salt, one will be generated.


mkpasswd -m SHA-512 test1234 OXE8gHwh2.nmuwp7

Note: You can also use the above to compare with and existing password to make sure you know what the password is.

Python example:

import crypt
# usage: crypt.crypt("password", "hasing algorithm + salt")
print(crypt.crypt("test1234", "$6$OXE8gHwh2.nmuwp7$"))
# sample output: $6$OXE8gHwh2.nmuwp7$lrs3VWJiL9bFG0HRjtSWI3T7hbQOIVOA8GewwM7nPaZKy7TXtiD/pKoEM.pQvR9NNpnZyP2qhCrsvVf1NJEFl/

ref: [1]

ref: [2]