Debian Codegraph @

sha1-hashcash.html

raw symbols SCIP
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <title>sha1</title>
5 <link rev="made" href="mailto:root@localhost" />
6 </head>
7
8 <body style="background-color: white">
9
10 <p><a name="__index__"></a></p>
11 <!-- INDEX BEGIN -->
12
13 <ul>
14
15 <li><a href="#name">NAME</a></li>
16 <li><a href="#synopsis">SYNOPSIS</a></li>
17 <ul>
18
19 <li><a href="#hash_files_">hash files:</a></li>
20 </ul>
21
22 <li><a href="#description">DESCRIPTION</a></li>
23 <li><a href="#other_implementations">OTHER IMPLEMENTATIONS</a></li>
24 <li><a href="#usage_notes">USAGE NOTES</a></li>
25 <li><a href="#examples">EXAMPLES</a></li>
26 <ul>
27
28 <li><a href="#hashing_files">Hashing files</a></li>
29 </ul>
30
31 <li><a href="#verifying_hashcash">Verifying Hashcash</a></li>
32 <li><a href="#limitations">LIMITATIONS</a></li>
33 <li><a href="#exit_status">EXIT STATUS</a></li>
34 <li><a href="#author">AUTHOR</a></li>
35 <li><a href="#see_also">SEE ALSO</a></li>
36 </ul>
37 <!-- INDEX END -->
38
39 <hr />
40 <p>
41 </p>
42 <h1><a name="name">NAME</a></h1>
43 <p>sha1 - Secure Hash Algorithm (version 1) hash function</p>
44 <p>
45 </p>
46 <hr />
47 <h1><a name="synopsis">SYNOPSIS</a></h1>
48 <p>
49 </p>
50 <h2><a name="hash_files_">hash files:</a></h2>
51 <p><strong>sha1</strong> [ <em>files</em> ]</p>
52 <p>
53 </p>
54 <hr />
55 <h1><a name="description">DESCRIPTION</a></h1>
56 <p>This is an implementation of the Secure Hash Algorithm version 1 as
57 defined in US Federal Information Processing Standard ``FIPS 180-1''.</p>
58 <p>This was shipped for convenience with the hashcash tool, but also functions
59 similarly to the widely distributed md5sum utility but using SHA1 instead of
60 MD5 so you may find other uses for it. (Some have argued that MD5 is too
61 small a hash to use for checking files if the attacker can insert chosen
62 files into your distribution as then a birthday attack becomes possible for
63 the master md5sum with work factor of about 2^64, which is a fairly high
64 cost but not infeasible.)</p>
65 <p>
66 </p>
67 <hr />
68 <h1><a name="other_implementations">OTHER IMPLEMENTATIONS</a></h1>
69 <p>This program is fairly compatible with <strong>openssl sha1</strong> (sha1(1)) and
70 <strong>sha1sum</strong> (sha1sum(1)) installed on some unix systems and included with
71 hashcash package so that a sha1 implementation is available for testing and
72 scripting if those packages are missing.</p>
73 <p>
74 </p>
75 <hr />
76 <h1><a name="usage_notes">USAGE NOTES</a></h1>
77 <p>The sha1 program will hash the files given on the command line, or if no
78 files are given it will hash the input fed to it on standard input. The
79 output format is a list of SHA1 hashes in hex followed by the corresponding
80 filenames, one per line.</p>
81 <p>
82 </p>
83 <hr />
84 <h1><a name="examples">EXAMPLES</a></h1>
85 <p>
86 </p>
87 <h2><a name="hashing_files">Hashing files</a></h2>
88 <dl>
89 <dt><strong><a name="item_sha1_file1_file2__5b_2e_2e_2e_5d"><code>sha1 file1 file2 [...]</code></a></strong><br />
90 </dt>
91 <dd>
92 Hashes the files listed on the command line and outputs their SHA1
93 message digests as 40 hexadecimal digits, followed by the filename,
94 one per line.
95 </dd>
96 <p></p>
97 <dt><strong><a name="item_echo__2dn_abc__7c_sha1"><code>echo -n abc | sha1</code></a></strong><br />
98 </dt>
99 <dd>
100 When no files are given, hashes from standard in. The example command
101 hashes the string ``abc'' from standard input. This string is
102 coincidentally one of the test vectors specified in FIPS 180-1 and
103 should output: <em>a9993e364706816aba3e25717850c26c9cd0d89d</em>.
104 </dd>
105 <p></p>
106 <dt><strong><a name="item_echo__2dn_abc__7c_sha1__2d"><code>echo -n abc | sha1 -</code></a></strong><br />
107 </dt>
108 <dd>
109 Equivalent to above. The filename of <em>-</em> means read from standard input.
110 </dd>
111 <p></p>
112 <dt><strong><a name="item_echo__2dn_abc__7c_sha1_test_2etxt__2d"><code>echo -n abc | sha1 test.txt -</code></a></strong><br />
113 </dt>
114 <dd>
115 You can also mix filenames and reading from standard input with the <em>-</em>
116 pseudo file. The above command first hashes file <code>test.txt</code> then reads the
117 string abc from standard in.
118 </dd>
119 <p></p></dl>
120 <p>
121 </p>
122 <hr />
123 <h1><a name="verifying_hashcash">Verifying Hashcash</a></h1>
124 <p>The SHA1 hash function is used by hashcash. You can use this sha1
125 utility to write shell scripts to verify hashcash tokens without using
126 the hashcash command line tool, or just to verify visually. Say you
127 received the following email:</p>
128 <pre>
129 From: Someone &lt;[email protected]&gt;
130 To: Adam Back &lt;[email protected]&gt;
131 Subject: test hashcash
132 Date: Thu, 15 Aug 2002 11:12:02 +0000
133 X-Hashcash: 0:030626:[email protected]:6470e06d773e05a8
134
135 Then the following command would show visually the size of the
136 preimage:</pre>
137 <dl>
138 <dt><strong><a name="item_echo__2dn_0_3a030626_3aadam_40cypherspace_2eorg_3a"><code>echo -n 0:030626:[email protected]:6470e06d773e05a8 | sha1</code></a></strong><br />
139 </dt>
140 <dd>
141 <pre>
142 00000000c70db7389f241b8f441fcf068aead3f0</pre>
143 </dd>
144 </dl>
145 <p>and you can see the leading hex 0s.</p>
146 <p>
147 </p>
148 <hr />
149 <h1><a name="limitations">LIMITATIONS</a></h1>
150 <p>Doesn't have the check option that md5sum has. Perhaps I'll add that in a
151 future version. Also doesn't have the binary / text distinction that md5sum
152 introduced for DOS/Windows benefit, nor the output convention signifying
153 text (* after hash). Can't say I've ever seen anyone use that feature
154 though.</p>
155 <p>
156 </p>
157 <hr />
158 <h1><a name="exit_status">EXIT STATUS</a></h1>
159 <p><code>sha1</code> returns success (exit code 0) normally.</p>
160 <p>If it can't read any of the files you give it on the comamnd line, it
161 instead returns failure (exit code 1).</p>
162 <p>
163 </p>
164 <hr />
165 <h1><a name="author">AUTHOR</a></h1>
166 <p>Written by Adam Back &lt;<a href="mailto:[email protected]">[email protected]</a>&gt;</p>
167 <p>
168 </p>
169 <hr />
170 <h1><a name="see_also">SEE ALSO</a></h1>
171 <p>md5sum(1), sha1(1), sha1sum(1), hashcash(1), <a href="http://www.hashcash.org/,">http://www.hashcash.org/,</a>
172 <a href="http://www.itl.nist.gov/fipspubs/fip180-1.htm">http://www.itl.nist.gov/fipspubs/fip180-1.htm</a></p>
173
174 </body>
175
176 </html>