Debian Codegraph @

sha1-hashcash.txt

raw
1 NAME
2 sha1 - Secure Hash Algorithm (version 1) hash function
3
4 SYNOPSIS
5 hash files:
6 sha1 [ *files* ]
7
8 DESCRIPTION
9 This is an implementation of the Secure Hash Algorithm version 1 as
10 defined in US Federal Information Processing Standard "FIPS 180-1".
11
12 This was shipped for convenience with the hashcash tool, but also
13 functions similarly to the widely distributed md5sum utility but using
14 SHA1 instead of MD5 so you may find other uses for it. (Some have argued
15 that MD5 is too small a hash to use for checking files if the attacker
16 can insert chosen files into your distribution as then a birthday attack
17 becomes possible for the master md5sum with work factor of about 2^64,
18 which is a fairly high cost but not infeasible.)
19
20 OTHER IMPLEMENTATIONS
21 This program is fairly compatible with openssl sha1 (sha1(1)) and
22 sha1sum (sha1sum(1)) installed on some unix systems and included with
23 hashcash package so that a sha1 implementation is available for testing
24 and scripting if those packages are missing.
25
26 USAGE NOTES
27 The sha1 program will hash the files given on the command line, or if no
28 files are given it will hash the input fed to it on standard input. The
29 output format is a list of SHA1 hashes in hex followed by the
30 corresponding filenames, one per line.
31
32 EXAMPLES
33 Hashing files
34 "sha1 file1 file2 [...]"
35 Hashes the files listed on the command line and outputs their SHA1
36 message digests as 40 hexadecimal digits, followed by the filename,
37 one per line.
38
39 "echo -n abc | sha1"
40 When no files are given, hashes from standard in. The example
41 command hashes the string "abc" from standard input. This string is
42 coincidentally one of the test vectors specified in FIPS 180-1 and
43 should output: *a9993e364706816aba3e25717850c26c9cd0d89d*.
44
45 "echo -n abc | sha1 -"
46 Equivalent to above. The filename of *-* means read from standard
47 input.
48
49 "echo -n abc | sha1 test.txt -"
50 You can also mix filenames and reading from standard input with the
51 *-* pseudo file. The above command first hashes file "test.txt" then
52 reads the string abc from standard in.
53
54 Verifying Hashcash
55 The SHA1 hash function is used by hashcash. You can use this sha1
56 utility to write shell scripts to verify hashcash tokens without using
57 the hashcash command line tool, or just to verify visually. Say you
58 received the following email:
59
60 From: Someone <[email protected]>
61 To: Adam Back <[email protected]>
62 Subject: test hashcash
63 Date: Thu, 15 Aug 2002 11:12:02 +0000
64 X-Hashcash: 0:030626:[email protected]:6470e06d773e05a8
65
66 Then the following command would show visually the size of the preimage:
67
68 "echo -n 0:030626:[email protected]:6470e06d773e05a8 | sha1"
69 00000000c70db7389f241b8f441fcf068aead3f0
70
71 and you can see the leading hex 0s.
72
73 LIMITATIONS
74 Doesn't have the check option that md5sum has. Perhaps I'll add that in
75 a future version. Also doesn't have the binary / text distinction that
76 md5sum introduced for DOS/Windows benefit, nor the output convention
77 signifying text (* after hash). Can't say I've ever seen anyone use that
78 feature though.
79
80 EXIT STATUS
81 "sha1" returns success (exit code 0) normally.
82
83 If it can't read any of the files you give it on the comamnd line, it
84 instead returns failure (exit code 1).
85
86 AUTHOR
87 Written by Adam Back <[email protected]>
88
89 SEE ALSO
90 md5sum(1), sha1(1), sha1sum(1), hashcash(1), http://www.hashcash.org/,
91 http://www.itl.nist.gov/fipspubs/fip180-1.htm
92