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 44The 45.Li RIPEMD160_ 46functions calculate a 160-bit cryptographic checksum (digest) 47for any number of input bytes. A cryptographic checksum is a one-way 48hash function; that is, it is computationally impractical to find 49the input corresponding to a particular output. This net result is 50a ``fingerprint'' of the input-data, which doesn't disclose the actual 51input. 52.Pp 53The 54.Fn RIPEMD160_Init , 55.Fn RIPEMD160_Update , 56and 57.Fn RIPEMD160_Final 58functions are the core functions. Allocate an RIPEMD160_CTX, initialize it with 59.Fn RIPEMD160_Init , 60run over the data with 61.Fn RIPEMD160_Update , 62and finally extract the result using 63.Fn RIPEMD160_Final . 64.Pp 65The 66.Fn RIPEMD160_End 67function is a wrapper for 68.Fn RIPEMD160_Final 69which converts the return value to a 41-character 70(including the terminating '\e0') 71.Tn ASCII 72string which represents the 160 bits in hexadecimal. 73.Pp 74The 75.Fn RIPEMD160_File 76function calculates the digest of a file, and uses 77.Fn RIPEMD160_End 78to return the result. 79If the file cannot be opened, a null pointer is returned. 80The 81.Fn RIPEMD160_FileChunk 82function is similar to 83.Fn RIPEMD160_File , 84but it only calculates the digest over a byte-range of the file specified, 85starting at 86.Fa offset 87and spanning 88.Fa length 89bytes. 90If the 91.Fa length 92parameter is specified as 0, or more than the length of the remaining part 93of the file, 94.Fn RIPEMD160_FileChunk 95calculates the digest from 96.Fa offset 97to the end of file. 98The 99.Fn RIPEMD160_Data 100function calculates the digest of a chunk of data in memory, and uses 101.Fn RIPEMD160_End 102to return the result. 103.Pp 104When using 105.Fn RIPEMD160_End , 106.Fn RIPEMD160_File , 107or 108.Fn RIPEMD160_Data , 109the 110.Fa buf 111argument can be a null pointer, in which case the returned string 112is allocated with 113.Xr malloc 3 114and subsequently must be explicitly deallocated using 115.Xr free 3 116after use. 117If the 118.Fa buf 119argument is non-null it must point to at least 41 characters of buffer space. 120.Sh SEE ALSO 121.Xr md2 3 , 122.Xr md4 3 , 123.Xr md5 3 , 124.Xr sha 3 125.Sh AUTHORS 126The core hash routines were implemented by Eric Young based on the 127published 128.Tn RIPEMD160 129specification. 130.Sh HISTORY 131These functions appeared in 132.Fx 4.0 . 133.Sh BUGS 134No method is known to exist which finds two files having the same hash value, 135nor to find a file with a specific hash value. 136There is on the other hand no guarantee that such a method doesn't exist. 137