What is a good way to perform a SHA256d hash (double SHA256) on an OpenBSD fresh install?

What is a good way to perform a SHA256d hash (double SHA256) on the default terminal of an network isolated OpenBSD fresh install?

Here’s what I’m doing:

echo test > testfile
cat testfile | openssl dgst -binary | openssl dgst

It gives me a number ending in 0xe0b6

Just wondering if there is a more concise/otherwise better way?

Asked By: Lee

||
openssl dgst -binary testfile | sha256

… is shorter, but there is no built-in way of applying the SHA256 hash twice on some input in any of the base utilities on OpenBSD.

Answered By: Kusalananda
Categories: Answers Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.