xref: /freebsd/lib/libmd/ripemd.3 (revision 7f3dea244c40159a41ab22da77a434d7c5b5e85a)
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 4.0
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 SYNOPSIS
24.Fd #include <sys/types.h>
25.Fd #include <ripemd.h>
26.Ft void
27.Fn RIPEMD160_Init "RIPEMD160_CTX *context"
28.Ft void
29.Fn RIPEMD160_Update "RIPEMD160_CTX *context" "const unsigned char *data" "unsigned int len"
30.Ft void
31.Fn RIPEMD160_Final "unsigned char digest[20]" "RIPEMD160_CTX *context"
32.Ft "char *"
33.Fn RIPEMD160_End "RIPEMD160_CTX *context" "char *buf"
34.Ft "char *"
35.Fn RIPEMD160_File "const char *filename" "char *buf"
36.Ft "char *"
37.Fn RIPEMD160_Data "const unsigned char *data" "unsigned int len" "char *buf"
38.Sh DESCRIPTION
39The
40.Li RIPEMD160_
41functions calculate a 160-bit cryptographic checksum (digest)
42for any number of input bytes.  A cryptographic checksum is a one-way
43hash function; that is, it is computationally impractical to find
44the input corresponding to a particular output.  This net result is
45a ``fingerprint'' of the input-data, which doesn't disclose the actual
46input.
47.Pp
48The
49.Fn RIPEMD160_Init  ,
50.Fn RIPEMD160_Update ,
51and
52.Fn RIPEMD160_Final
53functions are the core functions.  Allocate an RIPEMD160_CTX, initialize it with
54.Fn RIPEMD160_Init ,
55run over the data with
56.Fn RIPEMD160_Update ,
57and finally extract the result using
58.Fn RIPEMD160_Final .
59.Pp
60.Fn RIPEMD160_End
61is a wrapper for
62.Fn RIPEMD160_Final
63which converts the return value to a 41-character
64(including the terminating '\e0')
65.Tn ASCII
66string which represents the 160 bits in hexadecimal.
67.Pp
68.Fn RIPEMD160_File
69calculates the digest of a file, and uses
70.Fn RIPEMD160_End
71to return the result.
72If the file cannot be opened, a null pointer is returned.
73.Fn RIPEMD160_Data
74calculates the digest of a chunk of data in memory, and uses
75.Fn RIPEMD160_End
76to return the result.
77.Pp
78When using
79.Fn RIPEMD160_End ,
80.Fn RIPEMD160_File ,
81or
82.Fn RIPEMD160_Data ,
83the
84.Ar buf
85argument can be a null pointer, in which case the returned string
86is allocated with
87.Xr malloc 3
88and subsequently must be explicitly deallocated using
89.Xr free 3
90after use.
91If the
92.Ar buf
93argument is non-null it must point to at least 41 characters of buffer space.
94.Sh SEE ALSO
95.Xr md2 3 ,
96.Xr md4 3 ,
97.Xr md5 3 ,
98.Xr sha 3
99.Sh AUTHORS
100The core hash routines were implemented by Eric Young based on the
101published
102.Tn RIPEMD160
103specification.
104.Sh HISTORY
105These functions appeared in
106.Fx 4.0 .
107.Sh BUGS
108No method is known to exist which finds two files having the same hash value,
109nor to find a file with a specific hash value.
110There is on the other hand no guarantee that such a method doesn't exist.
111