HOST: Ubuntu 19.04
I downloaded the latest vbox and ran sha256sum (command line) on the file. The numbers match but the asterisk is missing. Here is my output followed by the sum on Oracle wbpage list of sha256 sums:
sha256sum:
0993d608a6922b152dd806aa39dc364176fd0b5d06df4d1511730a121a191401 virtualbox-6.1_6.1.6-137129~Ubuntu~eoan_amd64.deb
Oracle list sum:
0993d608a6922b152dd806aa39dc364176fd0b5d06df4d1511730a121a191401 *virtualbox-6.1_6.1.6-137129~Ubuntu~eoan_amd64.deb
Is this a match? If so, then why does Oracle put an asterisk in the line?
If the number is all that matters, why does sha256sum include the product description after the numbers e.g. virtualbox-6.1.6.... ?
Thank you for your help!
Sha256 checksum question
Sha256 checksum question
Last edited by Dorm18 on 14. May 2020, 00:14, edited 1 time in total.
-
- Posts: 79
- Joined: 9. May 2008, 15:54
- Primary OS: openSUSE
- VBox Version: PUEL
- Guest OSses: WinXP32 WinXP64 Win7-32 Win7-64 openSUSE64 OS2 Win10
- Location: Texas, USA
Re: Sha256 checksum question
The asterisk tells operating systems that distinguish between text files (newline
line separator) and binary files to treat the following file name as a binary file
when calculating the checksum.
line separator) and binary files to treat the following file name as a binary file
when calculating the checksum.
Re: Sha256 checksum question
Appreciate you reply. But I don't really understand when the file name and distinguishing it from text or binary is important.smithlar wrote:The asterisk tells operating systems that distinguish between text files (newline
line separator) and binary files to treat the following file name as a binary file
when calculating the checksum.
Learning this stuff now. Should I use the -b option when running the checksum? would that produce the asterisk? I want to be able to automate the comparison and not have to read the numbers one by one in the future.
Thank you.
-
- Site Moderator
- Posts: 20965
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Windows, Linux
Re: Sha256 checksum question
If you run a hash function on a series of files, the hash function may show the name of the file that goes with the hash. Otherwise you'd have a list of hashes and no idea which was which.
Only the hash serves to identify whether two files (might be) the same. If your hash function app is the same as the hash function app Oracle uses, then either they manually insert the asterisk to indicate the binary-only nature of the name, or they are using a command line switch you aren't using, etc. And if the app is different, then the layout of the hash and name might be different. MD5deep's SHA256deep.exe has two spaces between the hash and file name, maybe yours did too but the forum truncated the spaces? Or maybe yours only has one space. A 7-zip hash looks very different.
A binary vs text comparison is as follows:
binary = binary
binary != Binary
text = text = Text = TEXT = tEXt, etc.
I surmise that the asterisk tells whatever comparing app Oracle had in mind to find that:
virtualbox-6.1_6.1.6-137129~Ubuntu~eoan_amd64.deb != Virtualbox-6.1_6.1.6-137129~Ubuntu~eoan_amd64.deb
Only the hash serves to identify whether two files (might be) the same. If your hash function app is the same as the hash function app Oracle uses, then either they manually insert the asterisk to indicate the binary-only nature of the name, or they are using a command line switch you aren't using, etc. And if the app is different, then the layout of the hash and name might be different. MD5deep's SHA256deep.exe has two spaces between the hash and file name, maybe yours did too but the forum truncated the spaces? Or maybe yours only has one space. A 7-zip hash looks very different.
A binary vs text comparison is as follows:
binary = binary
binary != Binary
text = text = Text = TEXT = tEXt, etc.
I surmise that the asterisk tells whatever comparing app Oracle had in mind to find that:
virtualbox-6.1_6.1.6-137129~Ubuntu~eoan_amd64.deb != Virtualbox-6.1_6.1.6-137129~Ubuntu~eoan_amd64.deb
-
- Posts: 79
- Joined: 9. May 2008, 15:54
- Primary OS: openSUSE
- VBox Version: PUEL
- Guest OSses: WinXP32 WinXP64 Win7-32 Win7-64 openSUSE64 OS2 Win10
- Location: Texas, USA
Re: Sha256 checksum question
Assuming the text file named:
contains the SINGLE line:
Then the command:
will check that the sha256 checksum of the binary file named
matches the checksum specified inside the file
the asterisk in the line inside the file virtualbox-6.1_6.1.6-137129~Ubuntu~eoan_amd64.deb.sha256
merely tells "sha256sum -c" to treat the file to be checked as a binary file, not a text file.
Note - there is no difference between text and binary files on unix/linux systems, but on Windows
they are opened and read differently.
Here is the Man page for sha256sum
https://linux.die.net/man/1/sha256sum
Code: Select all
virtualbox-6.1_6.1.6-137129~Ubuntu~eoan_amd64.deb.sha256
Code: Select all
0993d608a6922b152dd806aa39dc364176fd0b5d06df4d1511730a121a191401 *virtualbox-6.1_6.1.6-137129~Ubuntu~eoan_amd64.deb
Code: Select all
sha256sum -c virtualbox-6.1_6.1.6-137129~Ubuntu~eoan_amd64.deb.sha256
Code: Select all
virtualbox-6.1_6.1.6-137129~Ubuntu~eoan_amd64.deb
Code: Select all
virtualbox-6.1_6.1.6-137129~Ubuntu~eoan_amd64.deb.sha256
merely tells "sha256sum -c" to treat the file to be checked as a binary file, not a text file.
Note - there is no difference between text and binary files on unix/linux systems, but on Windows
they are opened and read differently.
Here is the Man page for sha256sum
https://linux.die.net/man/1/sha256sum
Re: Sha256 checksum question
Your example is very good and much appreciated
I was reading the man page earlier. There it says this about -c option:
-c, --check
read SHA256 sums from the FILEs and check them
Which really doesn't help much without example. Guess I'll read the info coreutils aqsha256sum invocationaq
to get a more complete understanding.
Thanks again!
I was reading the man page earlier. There it says this about -c option:
-c, --check
read SHA256 sums from the FILEs and check them
Which really doesn't help much without example. Guess I'll read the info coreutils aqsha256sum invocationaq
to get a more complete understanding.
Thanks again!