1sha version 1.0.4 (2003-Jul-25) 2=============================== 3Copyright (c) 2001-2003 Allan Saddi <allan@saddi.com> 4All rights reserved. 5 6Redistribution and use in source and binary forms, with or without 7modification, are permitted provided that the following conditions 8are met: 91. Redistributions of source code must retain the above copyright 10 notice, this list of conditions and the following disclaimer. 112. Redistributions in binary form must reproduce the above copyright 12 notice, this list of conditions and the following disclaimer in the 13 documentation and/or other materials provided with the distribution. 14 15THIS SOFTWARE IS PROVIDED BY ALLAN SADDI AND HIS CONTRIBUTORS ``AS IS'' 16AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18ARE DISCLAIMED. IN NO EVENT SHALL ALLAN SADDI OR HIS CONTRIBUTORS BE 19LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25POSSIBILITY OF SUCH DAMAGE. 26 27Introduction 28------------ 29sha is a simple program that hashes files. It uses the National 30Institute of Standards and Technology's Secure Hash Algorithm. 31It can use SHA-1, SHA-256, SHA-384, or SHA-512, which generate 32respectively, hashes of 160, 256, 384, or 512 bits. sha can be 33used in scripts to do, for example, file integrity checking. 34 35For more information on SHA (the algorithms), visit: 36http://csrc.nist.gov/encryption/tkhash.html 37 38To build sha, see INSTALL. 39 40Using sha is simple. Just pass the names of one or more files on 41the command line. By default, sha will use SHA-1 unless passed 42one of the following flags: -2 for SHA-256, -3 for SHA-384 or 43-5 for SHA-512. Type "sha -h" for help. 44 45If no filenames are given, sha will hash stdin. 46 47If the environment variable SHA_DEFAULT is set, the default hashing 48algorithm can be changed. Only the first character of the value of 49SHA_DEFAULT is significant. It can be '1' for SHA-1, '2' for SHA-256, 50'3' for SHA-384, or '5' for SHA-512. With any other value, sha will 51use SHA-1 by default. Again, "sha -h" will display the default. 52 53You may want to perform a sanity check on sha before relying on it. A 54program called "shatest" is built along with sha (but not installed). 55If you run shatest, it will display the results of running the various 56SHA algorithms on a set of known test vectors. If the resultant hash 57matches what is expected, "PASS" will be displayed. Otherwise it will 58display "FAIL." 59 60Also, feel free to use my SHA implementations in your own projects. 61They are fast and relatively portable. Please see the top of each 62source file for copyright and warranty information. See README.SHA 63for technical notes. 64 65The latest version of sha can always be found at: 66http://philosophysw.com/ 67 68- Allan Saddi <allan@saddi.com> 69