How can I verify a checksum of a file by piping it? e.g. I want to do something like
curl -sL https://example.org/maybe-safe-maybe-not.tar.gz | md5sum 8da7904f495f682c39fa505b6404f9d1 | tar xvzC /usr/local/bin
md5sum or similar program will abort the pipeline if the given hash (as an arg) doesn't match, or forward the file outputs if it does match.
This would make my scripts a little more secure I think, because I can at least be sure I'm getting the version I tested with.
I can check the sum with a bit of hackery:
cat yarn.lock | md5sum -c <(echo 8da7904f495f682c39fa505b6404f9d1 -) --status
But I don't know how to forward the output of
yarn.lock after that.