How to create password hashed in Linux /etc/shadow format (crypted password)

To (easily) create passwords crypted with crypt(3), just use mkpasswd program, on debian it is in whois package.

Note

This observation might be obvious, but before I learned about this program I ended up creating my own implementation of it using python crypt module.

Note

If you wonder why mkpasswd is in whois package, here is the answer.