Main question: How to use xxd -r?
Secondary details. This command outputs a hexadecimal hash:
openssl dgst -sha256 myFile | awk '{print $2}' > myHashHex
I suppose that myHashHex is a "hexdump", isn't it?
I thought that xxd -r < myHashHex will convert... Well, it does not work.
NOTES
To test/compare. I think that this is the same (no headers) in binary:
openssl dgst -sha256 -binary myFile > myHashBin
So, I expected that xxd -r < myHashHex > newHashBin generates newHashBin=myHashBin.
PS: to test. The real life problem is to maintain all with sha256sum and only in one procedure convert it to double-sha256.
Instead, I use openssl dgst -sha256 -binary myFile| openssl dgst -sha256 > myDoubleHash
I would use the two-step procedure:
(always produce myHashHex)
openssl dgst -sha256 myFile | awk '{print $2}' > myHashHex(when need double)
xxd -r myHashHex | openssl dgst -sha256 > myDoubleHash