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

More by Jim

Tagged . All content copyright James Fisher 2017. This post is not associated with my employer. Found an error? Edit this page.