sha1sum -c

# openssl sha1 -c [b]filename[/b]

I think. Remember that not everyone who knows FreeBSD is intimately familiar with other operating systems, so it's helpful to tell what a command does.
 
shasum(1) looks like a good contender. SHA1 is the default.

Code:
$ pkg_info -W /usr/local/bin/shasum
/usr/local/bin/shasum was installed by package perl-5.10.1_3

It's almost impossible not to have it installed.
 
Yes, but it doesn't have the -c option. There ought to be an easier way to do this, but all that comes to mind is
% sha1 -q -s "testing" | sed 's%\(..\)%\1:%g'
 
wblock said:
Yes, but it doesn't have the -c option. There ought to be an easier way to do this, but all that comes to mind is
% sha1 -q -s "testing" | sed 's%\(..\)%\1:%g'

So if you already have a file with the sha1 checksums do this:

% sha1 /path/to/file | diff -u /path/to/file.sha -
 
Sorry, confusion on my part. -c is not to put colons every two characters in the checksum (sha1 on Linux), but to read checksums from a file. Doh.
 
Sorry for being vague in my original post, take 2:

I use [cmd=]sha1sum -c knownhashes.txt[/cmd] to check verify a file of list of known hashes against the checksum'med files. Knownhashes.txt is a file created by [cmd=]sha1sum *.doc > knownhashes.txt[/cmd]

In FreeBSD, I created a file of known hashes by [cmd=]sha1 *.doc > sha1file.txt[/cmd] How do I check sha1file.txt to verify the files? Is it possible to check the file without installing a new ports?
 
Code:
NAME
       shasum - Print or Check SHA Checksums

SYNOPSIS
	Usage: shasum [OPTION] [FILE]...
	   or: [B]shasum [OPTION] --check [FILE][/B]
	Print or check SHA checksums.
	With no FILE, or when FILE is -, read standard input.

	 -a, --algorithm    1 (default), 224, 256, 384, 512
	 -b, --binary	    read files in binary mode (default on DOS/Windows)
	 [B]-c, --check	    check SHA sums against given list[/B]

shasum(1). Tried it? It's part of Perl, so you probably already have it ...
 
@gordon, thanks, I think that's my only option.
@DutchDaemon, yes I did. but it expects the format which is output of sha1sum, it fails if the file of known hashes was generated by sha1 command
 
I actually got a request to merge these threads, but I felt it would be confusing.
 
Back
Top