Skip to content

Instantly share code, notes, and snippets.

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
# method 2: using slappasswd
# requires slapd package on Ubuntu
# method 2a: with static salt
slappasswd -h {CRYPT} -s secret -c '$6$foobar42'
# 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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment