1

I have a file.bin and file.bin.sha. The file.bin.sha has 32 bytes and contains binary data. How can I verify the checksum? sha256sum complains about no properly formatted SHA256 checksum lines found.

Pitel
  • 531

1 Answers1

3

Convert the 256-bit binary value to its hex ascii representation, and append the filename to create a check file that sha256sum will like:

echo $(od -An -tx1 file.bin.sha | tr -d '\n ') file.bin > my256
sha256sum -c my256

  • od - octal (binary, hex) dump of file
  • -An - suppress addresses
  • -tx1 - print as one byte values, hex
  • tr -d '\n ' - suppress blanks and newlines in the output
user4556274
  • 8,995
  • 2
  • 33
  • 37