I have a hash file that contains only the digest:
cat archive.hash
DBD47245A6E78626CBAD9A228C8956741BBA853E9D4A1DFCA6E335366C438C26341321E83B614834F78CD4D8FF71B05D5ADE8FAB3E0ECE5EF34A486D09882BB7
In order to accept the hash file as input and check, the sha512sum command requires that the file is formatted with a low chars digest followed by two spaces and the file name:
9a228c8956741bba853e9d4a1dfca6e335366c438c26341321e83b614834f78cd4d8ff71b05d5ade8fab3e0ece5ef34a486d09882bb7 archive.zip
I tried several syntax such as:
sha512sum -c <(echo "$(cat archive.hash |tr A-Z a-z) archive.zip")
But I receive this error:
sha512sum: /dev/fd/63: no properly formatted SHA512 checksum lines found
Analyzing the string:
echo "$(cat archive.hash |tr A-Z a-z) archive.zip"
The output is this:
archive.zip9a228c8956741bba853e9d4a1dfca6e335366c438c26341321e83b614834f78cd4d8ff71b05d5ade8fab3e0ece5ef34a486d09882bb7
It put the file name in front of the hash digest. How can this problem be avoided?