Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Generate salted SHA-512 hashes
# Using mkpasswd and slappasswd we will generate salted SHA-512 hashes
# password: secret
# method 1: using mkpasswd
# requires whois package on Ubuntu
mkpasswd --method=sha-512 --salt=foobar42
$6$foobar42$weYmU8biHjFLegPCuvGBSDaG0QMNucFv4Wq6.TGVK53/U0dp6bTrLYCLAdjecyX5mS1IA8vezYNjzTduU988B0
# method 2: using slappasswd
# requires slapd package on Ubuntu
# method 2a: with static salt
slappasswd -h {CRYPT} -s secret -c '$6$foobar42'
{CRYPT}$6$foobar42$weYmU8biHjFLegPCuvGBSDaG0QMNucFv4Wq6.TGVK53/U0dp6bTrLYCLAdjecyX5mS1IA8vezYNjzTduU988B0
# method 2b: with dynamic salt
# %.8s is replaced by 8 random characters
# see man page of slappasswd for details
slappasswd -h {CRYPT} -s secret -c '$6$%.8s'
{CRYPT}$6$X7g6B3FD$SH8Ii/AtZg8yrNvu3CwWwf0iXnUzCuaTSelzzL3DeJoY7JMkMD3yohDivtOSaWJQQOv6MHI0jRZ8c7rZGc5hq1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.