.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "SHA1-HASHCASH 1" .TH SHA1-HASHCASH 1 "2006-04-07" "1.22" "sha1" .SH "NAME" sha1 \- Secure Hash Algorithm (version 1) hash function .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Sh "hash files:" .IX Subsection "hash files:" \&\fBsha1\fR [ \fIfiles\fR ] .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is an implementation of the Secure Hash Algorithm version 1 as defined in \s-1US\s0 Federal Information Processing Standard \*(L"\s-1FIPS\s0 180\-1\*(R". .PP This was shipped for convenience with the hashcash tool, but also functions similarly to the widely distributed md5sum utility but using \s-1SHA1\s0 instead of \&\s-1MD5\s0 so you may find other uses for it. (Some have argued that \s-1MD5\s0 is too small a hash to use for checking files if the attacker can insert chosen files into your distribution as then a birthday attack becomes possible for the master md5sum with work factor of about 2^64, which is a fairly high cost but not infeasible.) .SH "OTHER IMPLEMENTATIONS" .IX Header "OTHER IMPLEMENTATIONS" This program is fairly compatible with \fBopenssl sha1\fR (\fIsha1\fR\|(1)) and \&\fBsha1sum\fR (\fIsha1sum\fR\|(1)) installed on some unix systems and included with hashcash package so that a sha1 implementation is available for testing and scripting if those packages are missing. .SH "USAGE NOTES" .IX Header "USAGE NOTES" The sha1 program will hash the files given on the command line, or if no files are given it will hash the input fed to it on standard input. The output format is a list of \s-1SHA1\s0 hashes in hex followed by the corresponding filenames, one per line. .SH "EXAMPLES" .IX Header "EXAMPLES" .Sh "Hashing files" .IX Subsection "Hashing files" .ie n .IP """sha1 file1 file2 [...]""" 4 .el .IP "\f(CWsha1 file1 file2 [...]\fR" 4 .IX Item "sha1 file1 file2 [...]" Hashes the files listed on the command line and outputs their \s-1SHA1\s0 message digests as 40 hexadecimal digits, followed by the filename, one per line. .ie n .IP """echo \-n abc | sha1""" 4 .el .IP "\f(CWecho \-n abc | sha1\fR" 4 .IX Item "echo -n abc | sha1" When no files are given, hashes from standard in. The example command hashes the string \*(L"abc\*(R" from standard input. This string is coincidentally one of the test vectors specified in \s-1FIPS\s0 180\-1 and should output: \fIa9993e364706816aba3e25717850c26c9cd0d89d\fR. .ie n .IP """echo \-n abc | sha1 \-""" 4 .el .IP "\f(CWecho \-n abc | sha1 \-\fR" 4 .IX Item "echo -n abc | sha1 -" Equivalent to above. The filename of \fI\-\fR means read from standard input. .ie n .IP """echo \-n abc | sha1 test.txt \-""" 4 .el .IP "\f(CWecho \-n abc | sha1 test.txt \-\fR" 4 .IX Item "echo -n abc | sha1 test.txt -" You can also mix filenames and reading from standard input with the \fI\-\fR pseudo file. The above command first hashes file \f(CW\*(C`test.txt\*(C'\fR then reads the string abc from standard in. .SH "Verifying Hashcash" .IX Header "Verifying Hashcash" The \s-1SHA1\s0 hash function is used by hashcash. You can use this sha1 utility to write shell scripts to verify hashcash tokens without using the hashcash command line tool, or just to verify visually. Say you received the following email: .PP .Vb 5 \& From: Someone \& To: Adam Back \& Subject: test hashcash \& Date: Thu, 15 Aug 2002 11:12:02 +0000 \& X-Hashcash: 0:030626:adam@cypherspace.org:6470e06d773e05a8 .Ve .PP Then the following command would show visually the size of the preimage: .ie n .IP """echo \-n 0:030626:adam@cypherspace.org:6470e06d773e05a8 | sha1""" 4 .el .IP "\f(CWecho \-n 0:030626:adam@cypherspace.org:6470e06d773e05a8 | sha1\fR" 4 .IX Item "echo -n 0:030626:adam@cypherspace.org:6470e06d773e05a8 | sha1" .Vb 1 \& 00000000c70db7389f241b8f441fcf068aead3f0 .Ve .PP and you can see the leading hex 0s. .SH "LIMITATIONS" .IX Header "LIMITATIONS" Doesn't have the check option that md5sum has. Perhaps I'll add that in a future version. Also doesn't have the binary / text distinction that md5sum introduced for DOS/Windows benefit, nor the output convention signifying text (* after hash). Can't say I've ever seen anyone use that feature though. .SH "EXIT STATUS" .IX Header "EXIT STATUS" \&\f(CW\*(C`sha1\*(C'\fR returns success (exit code 0) normally. .PP If it can't read any of the files you give it on the comamnd line, it instead returns failure (exit code 1). .SH "AUTHOR" .IX Header "AUTHOR" Written by Adam Back .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fImd5sum\fR\|(1), \fIsha1\fR\|(1), \fIsha1sum\fR\|(1), \fIhashcash\fR\|(1), http://www.hashcash.org/, http://www.itl.nist.gov/fipspubs/fip180\-1.htm