]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - lib/libmd/ripemd.3
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / lib / libmd / ripemd.3
1 .\"
2 .\" ----------------------------------------------------------------------------
3 .\" "THE BEER-WARE LICENSE" (Revision 42):
4 .\" <phk@FreeBSD.org> 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
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_FileChunk ,
22 .Nm RIPEMD160_Data
23 .Nd calculate the RIPEMD160 message digest
24 .Sh LIBRARY
25 .Lb libmd
26 .Sh SYNOPSIS
27 .In sys/types.h
28 .In ripemd.h
29 .Ft void
30 .Fn RIPEMD160_Init "RIPEMD160_CTX *context"
31 .Ft void
32 .Fn RIPEMD160_Update "RIPEMD160_CTX *context" "const unsigned char *data" "unsigned int len"
33 .Ft void
34 .Fn RIPEMD160_Final "unsigned char digest[20]" "RIPEMD160_CTX *context"
35 .Ft "char *"
36 .Fn RIPEMD160_End "RIPEMD160_CTX *context" "char *buf"
37 .Ft "char *"
38 .Fn RIPEMD160_File "const char *filename" "char *buf"
39 .Ft "char *"
40 .Fn RIPEMD160_FileChunk "const char *filename" "char *buf" "off_t offset" "off_t length"
41 .Ft "char *"
42 .Fn RIPEMD160_Data "const unsigned char *data" "unsigned int len" "char *buf"
43 .Sh DESCRIPTION
44 The
45 .Li RIPEMD160_
46 functions calculate a 160-bit cryptographic checksum (digest)
47 for any number of input bytes.
48 A cryptographic checksum is a one-way
49 hash function; that is, it is computationally impractical to find
50 the input corresponding to a particular output.
51 This net result is a
52 .Dq fingerprint
53 of the input-data, which does not disclose the actual input.
54 .Pp
55 The
56 .Fn RIPEMD160_Init ,
57 .Fn RIPEMD160_Update ,
58 and
59 .Fn RIPEMD160_Final
60 functions are the core functions.
61 Allocate an
62 .Vt RIPEMD160_CTX ,
63 initialize it with
64 .Fn RIPEMD160_Init ,
65 run over the data with
66 .Fn RIPEMD160_Update ,
67 and finally extract the result using
68 .Fn RIPEMD160_Final .
69 .Pp
70 The
71 .Fn RIPEMD160_End
72 function is a wrapper for
73 .Fn RIPEMD160_Final
74 which converts the return value to a 41-character
75 (including the terminating '\e0')
76 .Tn ASCII
77 string which represents the 160 bits in hexadecimal.
78 .Pp
79 The
80 .Fn RIPEMD160_File
81 function calculates the digest of a file, and uses
82 .Fn RIPEMD160_End
83 to return the result.
84 If the file cannot be opened, a null pointer is returned.
85 The
86 .Fn RIPEMD160_FileChunk
87 function is similar to
88 .Fn RIPEMD160_File ,
89 but it only calculates the digest over a byte-range of the file specified,
90 starting at
91 .Fa offset
92 and spanning
93 .Fa length
94 bytes.
95 If the
96 .Fa length
97 parameter is specified as 0, or more than the length of the remaining part
98 of the file,
99 .Fn RIPEMD160_FileChunk
100 calculates the digest from
101 .Fa offset
102 to the end of file.
103 The
104 .Fn RIPEMD160_Data
105 function calculates the digest of a chunk of data in memory, and uses
106 .Fn RIPEMD160_End
107 to return the result.
108 .Pp
109 When using
110 .Fn RIPEMD160_End ,
111 .Fn RIPEMD160_File ,
112 or
113 .Fn RIPEMD160_Data ,
114 the
115 .Fa buf
116 argument can be a null pointer, in which case the returned string
117 is allocated with
118 .Xr malloc 3
119 and subsequently must be explicitly deallocated using
120 .Xr free 3
121 after use.
122 If the
123 .Fa buf
124 argument is non-null it must point to at least 41 characters of buffer space.
125 .Sh SEE ALSO
126 .Xr md2 3 ,
127 .Xr md4 3 ,
128 .Xr md5 3 ,
129 .Xr sha 3
130 .Sh HISTORY
131 These functions appeared in
132 .Fx 4.0 .
133 .Sh AUTHORS
134 The core hash routines were implemented by Eric Young based on the
135 published
136 .Tn RIPEMD160
137 specification.
138 .Sh BUGS
139 No method is known to exist which finds two files having the same hash value,
140 nor to find a file with a specific hash value.
141 There is on the other hand no guarantee that such a method does not exist.