checking sha256 checksum

satinder singh

I was trying to check the authenticity of a download by using the shasum in ubuntu. I am unable to understand the syntax though.

The code below works

1) echo "<sha-hash> *filename" | shasum -a 256 -c 

I wanted to know why are we putting a "*"(asterisk) before the file name.

I also tried generating a file using

2) shasum -a 256 filename > file.sha
3) shasum -a 256 -c file.sha

The above code also works.When I oped the file.sha file I saw

<hash> <filename>

There is no asterisk present in the file. I tried writing the it 1st statement without asterisk, then it throws a error stating

shasum: standard input: no properly formatted SHA1 checksum lines found

Thank you.

Florian Diesch

Putting an asterisk before the file name tells shasum to treat the file as binary if the system supports this. Id the file should be treated as text file you use a single blank instead.

Linux doesn't make a difference between binary and text files so it doesn't matter which one you use, but you can't leave it out.

So you have to use

<hash>  <filename>

with two blanks after the hash: One blank that separates the hash from the filename and one blank for text mode.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related