SHA1-HASHCASH(1)
β¨ NAME β¨
The SHA1-HASHCASH(1) manual page is all about sha1, the Secure Hash Algorithm (version 1) hash function. Bestie, itβs literally the SHA1 moment. π
π SYNOPSIS π
Hash files, slay:
sha1 [ files ]
π DESCRIPTION π
Okay so this is an implementation of the Secure Hash Algorithm version 1, exactly as defined in the US Federal Information Processing Standard "FIPS 180-1". No cap.
It was shipped for convenience with the hashcash tool, but it also functions similarly to the widely distributed md5sum utility β except it uses SHA1 instead of MD5, so you may find other uses for it. Iconic behavior. π
Some have argued that MD5 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. Not me learning threat models in the manual. π
π OTHER IMPLEMENTATIONS π
This program is fairly compatible with openssl sha1 (sha1(1)) and sha1sum (sha1sum(1)) installed on some unix systems and included with the hashcash package, so that a sha1 implementation is available for testing and scripting if those packages are missing. Convenient? Very. π«Ά
π¦ 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 SHA1 hashes in hex followed by the corresponding filenames, one per line. One per line, bestie β keep up. β¨
π₯ EXAMPLES π₯
πΈ Hashing files πΈ
sha1 file1 file2 [...]
Hashes the files listed on the command line and outputs their SHA1 message digests as 40 hexadecimal digits, followed by the filename, one per line. Forty whole hex digits. Obsessed. π
echo -n abc βͺ sha1
When no files are given, hashes from standard in. The example command hashes the string "abc" from standard input. This string is coincidentally one of the test vectors specified in FIPS 180-1 and should output: a9993e364706816aba3e25717850c26c9cd0d89d. Test vector ate. π
echo -n abc βͺ sha1 -
Equivalent to above. The filename of - means read from standard input. Little dash, big main character energy. π
echo -n abc βͺ sha1 test.txt -
You can also mix filenames and reading from standard input with the - pseudo file. The above command first hashes file test.txt then reads the string abc from standard in. Mix and match, iykyk. π¦
π§ Verifying Hashcash π§
The SHA1 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: vibe check the headers: π
From: Someone <test@test.invalid>
To: Adam Back <adam@cypherspace.org>
Subject: test hashcash
Date: Thu, 15 Aug 2002 11:12:02 +0000
X-Hashcash: 0:030626:adam@cypherspace.org:6470e06d773e05a8
Then the following command would show visually the size of the preimage:
echo -n 0:030626:adam@cypherspace.org:6470e06d773e05a8 βͺ sha1
00000000c70db7389f241b8f441fcf068aead3f0
and you can see the leading hex 0s. Leading zeros are the whole aesthetic. π
π LIMITATIONS π
Doesnβt have the check option that md5sum has. Perhaps itβll get added 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. Respectfully, no oneβs using that. π
β EXIT STATUS β
sha1 returns success (exit code 0) normally. Slay.
If it canβt read any of the files you give it on the command line, it instead returns failure (exit code 1). Not slay, but important. π
π AUTHOR π
Written by Adam Back <adam@cypherspace.org>. Author icon. π«Ά
π SEE ALSO π
md5sum(1)sha1(1)sha1sum(1)hashcash(1)http://www.hashcash.org/http://www.itl.nist.gov/fipspubs/fip180-1.htm
This page is from the sha1 manual, version 1.22, dated 2006-04-07 β byeee bestie! ππ
π¦ where this page comes from
- alpine 3.24: hashcash-doc 1.22-r0 Β· Public-Domain
- nixos 26.05: hashcash 1.22
- nixpkgs unstable: hashcash 1.22
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms