xref: /freebsd/lib/libmd/ripemd.3 (revision ed403116940cbbd5dad8a3d1c3aa0e1e9771a4e9)
1.\"
2.\" ----------------------------------------------------------------------------
3.\" "THE BEER-WARE LICENSE" (Revision 42):
4.\" <phk@login.dkuug.dk> wrote this file.  As long as you retain this notice you
5.\" can do whatever you want with this stuff. If we meet some day, and you think
6.\" this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
7.\" ----------------------------------------------------------------------------
8.\"
9.\" 	From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp
10.\" $FreeBSD$
11.\"
12.Dd February 26, 1999
13.Dt RIPEMD 3
14.Os FreeBSD
15.Sh NAME
16.Nm RIPEMD160_Init ,
17.Nm RIPEMD160_Update ,
18.Nm RIPEMD160_Final ,
19.Nm RIPEMD160_End ,
20.Nm RIPEMD160_File ,
21.Nm RIPEMD160_Data
22.Nd calculate the RIPEMD160 message digest
23.Sh LIBRARY
24.Lb libmd
25.Sh SYNOPSIS
26.Fd #include <sys/types.h>
27.Fd #include <ripemd.h>
28.Ft void
29.Fn RIPEMD160_Init "RIPEMD160_CTX *context"
30.Ft void
31.Fn RIPEMD160_Update "RIPEMD160_CTX *context" "const unsigned char *data" "unsigned int len"
32.Ft void
33.Fn RIPEMD160_Final "unsigned char digest[20]" "RIPEMD160_CTX *context"
34.Ft "char *"
35.Fn RIPEMD160_End "RIPEMD160_CTX *context" "char *buf"
36.Ft "char *"
37.Fn RIPEMD160_File "const char *filename" "char *buf"
38.Ft "char *"
39.Fn RIPEMD160_Data "const unsigned char *data" "unsigned int len" "char *buf"
40.Sh DESCRIPTION
41The
42.Li RIPEMD160_
43functions calculate a 160-bit cryptographic checksum (digest)
44for any number of input bytes.  A cryptographic checksum is a one-way
45hash function; that is, it is computationally impractical to find
46the input corresponding to a particular output.  This net result is
47a ``fingerprint'' of the input-data, which doesn't disclose the actual
48input.
49.Pp
50The
51.Fn RIPEMD160_Init  ,
52.Fn RIPEMD160_Update ,
53and
54.Fn RIPEMD160_Final
55functions are the core functions.  Allocate an RIPEMD160_CTX, initialize it with
56.Fn RIPEMD160_Init ,
57run over the data with
58.Fn RIPEMD160_Update ,
59and finally extract the result using
60.Fn RIPEMD160_Final .
61.Pp
62.Fn RIPEMD160_End
63is a wrapper for
64.Fn RIPEMD160_Final
65which converts the return value to a 41-character
66(including the terminating '\e0')
67.Tn ASCII
68string which represents the 160 bits in hexadecimal.
69.Pp
70.Fn RIPEMD160_File
71calculates the digest of a file, and uses
72.Fn RIPEMD160_End
73to return the result.
74If the file cannot be opened, a null pointer is returned.
75.Fn RIPEMD160_Data
76calculates the digest of a chunk of data in memory, and uses
77.Fn RIPEMD160_End
78to return the result.
79.Pp
80When using
81.Fn RIPEMD160_End ,
82.Fn RIPEMD160_File ,
83or
84.Fn RIPEMD160_Data ,
85the
86.Ar buf
87argument can be a null pointer, in which case the returned string
88is allocated with
89.Xr malloc 3
90and subsequently must be explicitly deallocated using
91.Xr free 3
92after use.
93If the
94.Ar buf
95argument is non-null it must point to at least 41 characters of buffer space.
96.Sh SEE ALSO
97.Xr md2 3 ,
98.Xr md4 3 ,
99.Xr md5 3 ,
100.Xr sha 3
101.Sh AUTHORS
102The core hash routines were implemented by Eric Young based on the
103published
104.Tn RIPEMD160
105specification.
106.Sh HISTORY
107These functions appeared in
108.Fx 4.0 .
109.Sh BUGS
110No method is known to exist which finds two files having the same hash value,
111nor to find a file with a specific hash value.
112There is on the other hand no guarantee that such a method doesn't exist.
113