If your want to hash a password use mkpasswd command, it is very helpful to generate encrypted password through Linux command,


If you could not found the mkpasswd command install whois package,


$ sudo apt-get install whois

$ mkpasswd -m help

    Available methods:
    des    standard 56 bit DES-based crypt(3)
    md5    MD5
    sha-256    SHA-256
    sha-512    SHA-512


 MD5 is a hashing algorithm that can be and is typical, used on a wide range of data including whole CD-ROM images. 

MD5 :

# mkpasswd -m MD5

Password: 
$1$wZvrHu2q$KMEUNKakU84Tu.jJw6T3o0

SHA-256:

# mkpasswd -m sha-256

Password: 
$5$wOAo/rkS$.uzNu4weQezjuefHr.LjlDrDLa8qrttUbaWcpqONEZ7

SHA-512:

# mkpasswd -m sha-512

Password: 
$6$KShJIiQa6I$NxOq0tz/HVctZkrhHWNcqUWWERDDrdBgOJT96YcQzL1cR75bxvYNoLsu.VXGpl6G2d0j0DfQ.Jns9FPOlzK7v1


or use the below command,


$ python -c 'import crypt; print crypt.crypt("thelinuxfaq", "$6$random_salt")'

$ python3 -c 'import crypt; print(crypt.crypt("thelinxfaq", crypt.mksalt(crypt.METHOD_SHA512)))'