How do I create a message digest using openssl?

The openssl tool has a dgst command which creates message digests. Here’s an example:

$ echo 'hello world' | openssl dgst -sha512 -hex

Various flags change the hash algorithm, e.g. -sha1.

A useful flag is -hmac, which lets you sign the content with a shared password:

$ echo 'hello world' | openssl dgst -sha1 -hex -hmac secret_password_1

Get updates on Twitter

I wrote this because I'm learning SSL, starting by going through the CLI tool commands This post is not associated with my employer. This site is hosted by Netlify (who are great, but I'm not associated with them either).