1.\" $OpenBSD: RIPEMD160.3,v 1.8 2024/05/26 09:54:16 tb Exp $ 2.\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000 3.\" 4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 5.\" Copyright (c) 2000, 2006, 2014 The OpenSSL Project. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in 16.\" the documentation and/or other materials provided with the 17.\" distribution. 18.\" 19.\" 3. All advertising materials mentioning features or use of this 20.\" software must display the following acknowledgment: 21.\" "This product includes software developed by the OpenSSL Project 22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 23.\" 24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 25.\" endorse or promote products derived from this software without 26.\" prior written permission. For written permission, please contact 27.\" openssl-core@openssl.org. 28.\" 29.\" 5. Products derived from this software may not be called "OpenSSL" 30.\" nor may "OpenSSL" appear in their names without prior written 31.\" permission of the OpenSSL Project. 32.\" 33.\" 6. Redistributions of any form whatsoever must retain the following 34.\" acknowledgment: 35.\" "This product includes software developed by the OpenSSL Project 36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" 37.\" 38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" 51.Dd $Mdocdate: May 26 2024 $ 52.Dt RIPEMD160 3 53.Os 54.Sh NAME 55.Nm RIPEMD160 , 56.Nm RIPEMD160_Init , 57.Nm RIPEMD160_Update , 58.Nm RIPEMD160_Final 59.Nd RIPEMD-160 hash function 60.Sh SYNOPSIS 61.In openssl/ripemd.h 62.Ft unsigned char * 63.Fo RIPEMD160 64.Fa "const unsigned char *d" 65.Fa "unsigned long n" 66.Fa "unsigned char *md" 67.Fc 68.Ft int 69.Fo RIPEMD160_Init 70.Fa "RIPEMD160_CTX *c" 71.Fc 72.Ft int 73.Fo RIPEMD160_Update 74.Fa "RIPEMD160_CTX *c" 75.Fa "const void *data" 76.Fa "unsigned long len" 77.Fc 78.Ft int 79.Fo RIPEMD160_Final 80.Fa "unsigned char *md" 81.Fa "RIPEMD160_CTX *c" 82.Fc 83.Sh DESCRIPTION 84RIPEMD-160 is a cryptographic hash function with a 160-bit output. 85.Pp 86.Fn RIPEMD160 87computes the RIPEMD-160 message digest of the 88.Fa n 89bytes at 90.Fa d 91and places it in 92.Fa md , 93which must have space for 94.Dv RIPEMD160_DIGEST_LENGTH 95== 20 bytes of output. 96.Pp 97The following functions may be used if the message is not completely 98stored in memory: 99.Pp 100.Fn RIPEMD160_Init 101initializes a 102.Vt RIPEMD160_CTX 103structure. 104.Pp 105.Fn RIPEMD160_Update 106can be called repeatedly with chunks of the message to be hashed 107.Pq Fa len No bytes at Fa data . 108.Pp 109.Fn RIPEMD160_Final 110places the message digest in 111.Fa md , 112which must have space for 113.Dv RIPEMD160_DIGEST_LENGTH 114== 20 bytes of output, 115and erases the 116.Vt RIPEMD160_CTX . 117.Pp 118Applications should use the higher level functions 119.Xr EVP_DigestInit 3 120etc. instead of calling the hash functions directly. 121.Sh RETURN VALUES 122.Fn RIPEMD160 123returns a pointer to the hash value. 124.Pp 125.Fn RIPEMD160_Init , 126.Fn RIPEMD160_Update , 127and 128.Fn RIPEMD160_Final 129return 1 for success or 0 otherwise. 130.Sh SEE ALSO 131.Xr EVP_DigestInit 3 , 132.Xr HMAC 3 133.Sh STANDARDS 134.Bd -unfilled 135ISO/IEC 10118-3:2004/Cor 1:2011 136Hash-functions \(em Part 3: Dedicated hash-functions 137Clause 7: RIPEMD-160 138.Ed 139.Sh HISTORY 140.Fn RIPEMD160 , 141.Fn RIPEMD160_Init , 142.Fn RIPEMD160_Update , 143and 144.Fn RIPEMD160_Final 145first appeared in SSLeay 0.9.0 and have been available since 146.Ox 2.4 . 147.Sh CAVEATS 148Other implementations allow 149.Fa md 150in 151.Fn RIPEMD160 152to be 153.Dv NULL 154and return a static array, which is not thread safe. 155