1 .\" $NetBSD: rmd160.3,v 1.1 2005/09/24 19:07:00 elad Exp $
2 .\" $OpenBSD: rmd160.3,v 1.12 2000/04/18 03:01:29 aaron Exp $
4 .\" Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 3. The name of the author may not be used to endorse or promote products
16 .\" derived from this software without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19 .\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20 .\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21 .\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 .\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 .\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24 .\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27 .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 .\" See http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html
30 .\" for detailed information about RIPEMD-160.
43 .Nd calculate the ``RIPEMD-160'' message digest
48 .Fn RMD160Init "RMD160_CTX *context"
50 .Fn RMD160Update "RMD160_CTX *context" "const u_char *data" "u_int nbytes"
52 .Fn RMD160Final "u_char digest[20]" "RMD160_CTX *context"
54 .Fn RMD160Transform "uint32_t state[5]" "const uint32_t block[16]"
56 .Fn RMD160End "RMD160_CTX *context" "char *buf"
58 .Fn RMD160File "char *filename" "char *buf"
60 .Fn RMD160Data "u_char *data" "size_t len" "char *buf"
62 The RMD160 functions implement the 160-bit RIPE message digest hash algorithm
64 RMD-160 is used to generate a condensed representation
65 of a message called a message digest.
67 message less than 2^64 bits as input and produces a 160-bit digest
68 suitable for use as a digital signature.
70 The RMD160 functions are considered to be more secure than the
74 functions and at least as secure as the
77 All share a similar interface.
81 function initializes a RMD160_CTX
93 to the RMD160_CTX specified by
96 is called when all data has been added via
98 and stores a message digest in the
101 When a null pointer is passed to
103 as first argument only the final padding will be applied and the
104 current context can still be used with
111 to hash 512-bit blocks and forms the core of the algorithm.
112 Most programs should use the interface provided by
123 function is a front end for
125 which converts the digest into an
127 representation of the 160 bit digest in hexadecimal.
131 function calculates the digest for a file and returns the result via
135 is unable to open the file a NULL pointer is returned.
140 calculates the digest of an arbitrary string and returns the result via
150 parameter should either be a string of at least 41 characters in
151 size or a NULL pointer.
152 In the latter case, space will be dynamically allocated via
154 and should be freed using
156 when it is no longer needed.
158 The follow code fragment will calculate the digest for
159 the string "abc" which is ``0x8eb208f7e05d987a9b044a8e98c6b087f15a0bfc''.
160 .Bd -literal -offset indent
168 RMD160Init(\*[Am]rmd);
169 RMD160Update(\*[Am]rmd, (u_char *)buf, n);
170 RMD160Final(results, \*[Am]rmd);
172 /* Print the digest as one long hex value */
174 for (n = 0; n \*[Lt] 20; n++)
175 printf("%02x", results[n]);
179 Alternately, the helper functions could be used in the following way:
180 .Bd -literal -offset indent
185 printf("0x%s\en", RMD160Data(buf, strlen(buf), output));
194 .%A H. Dobbertin, A. Bosselaers, B. Preneel
195 .%T RIPEMD-160, a strengthened version of RIPEMD
198 .%T Information technology - Security techniques - Hash-functions - Part 3: Dedicated hash-functions
202 .%A H. Dobbertin, A. Bosselaers, B. Preneel
203 .%T The RIPEMD-160 cryptographic hash function
204 .%J Dr. Dobb's Journal
210 The RMD-160 functions appeared in
213 This implementation of RMD-160 was written by Antoon Bosselaers.
220 helper functions are derived from code written by Poul-Henning Kamp.
222 If a message digest is to be copied to a multi-byte type (ie:
223 an array of five 32-bit integers) it will be necessary to
224 perform byte swapping on little endian machines such as the i386, alpha,