RIPEMD(3)
π RIPEMD(3) β the ripemd girlies are here
okay so bestie, welcome to the RIPEMD160 page, from the Library Functions Manual, and honestly it's a whole moment. no cap, it's giving "cryptographic fingerprint" energy and i'm obsessed. let me walk you through it π
β¨ NAME β¨
RIPEMD160_Init, RIPEMD160_Update, RIPEMD160_Final, RIPEMD160_End, RIPEMD160_Fd, RIPEMD160_FdChunk, RIPEMD160_File, RIPEMD160_FileChunk, RIPEMD160_Data β literally all of them, bestie, and their whole entire job is calculating the RIPEMD160 message digest π¦
π LIBRARY π
Message Digest (MD4, MD5, etc.) Support Library β that's libmd, and you link it with -lmd π
πΈ SYNOPSIS πΈ
here's the part where you copy-paste, bestie. no shame.
#include <sys/types.h>
#include <ripemd.h>
void
RIPEMD160_Init(RIPEMD160_CTX *context);
void
RIPEMD160_Update(RIPEMD160_CTX *context, const unsigned char *data,
unsigned int len);
void
RIPEMD160_Final(unsigned char digest[20], RIPEMD160_CTX *context);
char *
RIPEMD160_End(RIPEMD160_CTX *context, char *buf);
char *
RIPEMD160_Fd(int fd, char *buf);
char *
RIPEMD160_FdChunk(int fd, char *buf, off_t offset, off_t length);
char *
RIPEMD160_File(const char *filename, char *buf);
char *
RIPEMD160_FileChunk(const char *filename, char *buf, off_t offset,
off_t length);
char *
RIPEMD160_Data(const unsigned char *data, unsigned int len, char *buf);
π DESCRIPTION π
so the RIPEMD160_ functions (all of them, collectively, they're a team π
) calculate a 160-bit cryptographic checksum β a digest β for any number of input bytes. any. number. slay.
a cryptographic checksum is a one-way hash function, meaning it's computationally impractical to find the input that corresponds to a particular output. it just doesn't happen, bestie. the net result is basically a "fingerprint" of the input-data β and here's the iconic part β it does not disclose the actual input. the math ate and left no crumbs π₯
π the core trio π
RIPEMD160_Init(), RIPEMD160_Update(), and RIPEMD160_Final() are the core functions. the whole ritual is:
- Allocate an
RIPEMD160_CTX - Initialize it with
RIPEMD160_Init() - Run over the data with
RIPEMD160_Update() - Finally extract the result using
RIPEMD160_Final()
and plot twist β RIPEMD160_Final() will also erase the RIPEMD160_CTX. it cleans up after itself. main character energy honestly π
β¨ the wrapper squad β¨
RIPEMD160_End()β a wrapper forRIPEMD160_Final()which converts the return value to a 41-character (including the terminating'\0') ASCII string, representing the 160 bits in hexadecimal πRIPEMD160_File()β calculates the digest of a file, and usesRIPEMD160_End()to return the result. if the file cannot be opened, a null pointer is returned πRIPEMD160_FileChunk()β similar toRIPEMD160_File(), but it only calculates the digest over a byte-range of the file specified, starting at offset and spanning length bytes. and get this: if the length parameter is specified as0, or more than the length of the remaining part of the file,RIPEMD160_FileChunk()calculates the digest from offset to the end of file. it just keeps going. iconic πRIPEMD160_Data()β calculates the digest of a chunk of data in memory, and usesRIPEMD160_End()to return the result πRIPEMD160_Fd()andRIPEMD160_FdChunk()β identical to theirRIPEMD160_File()andRIPEMD160_FileChunk()counterparts, with the exception that the first argument is an fd instead of a filename. same vibe, different door πͺ
π«Ά buf tea, listen up bestie: when you're usingRIPEMD160_End(),RIPEMD160_File(), orRIPEMD160_Data(), the buf argument can be a null pointer, in which case the returned string is allocated withmalloc(3)and subsequently must be explicitly deallocated usingfree(3)after use. don't forget, or that's a leak, and leaks are not the vibe. if the buf argument is non-null it must point to at least 41 characters of buffer space. 41. not 40. π₯
π ERRORS π
the RIPEMD160_End() function called with a null buf argument may fail and return NULL if:
[ENOMEM]β insufficient storage space is available π
and RIPEMD160_File() and RIPEMD160_FileChunk() may return NULL when underlying open(2), fstat(2), lseek(2), or RIPEMD160_End(3) fail. rough out here fr fr π
π¦ SEE ALSO π¦
the whole hash family, we love a supportive friend group πΈ
β HISTORY β
these functions appeared in FreeBSD 4.0. vintage. retro. lowkey a legacy queen π
π AUTHORS π
the core hash routines were implemented by Eric Young, based on the published RIPEMD160 specification. periodt. we stan π
π BUGS π
no method is known to exist which finds two files having the same hash value, nor to find a file with a specific hash value. however β and this is the part where you sit down β there is on the other hand no guarantee that such a method does not exist. π the math is mathing but we stay humble π§
and that's the page, bestie β¨ this one's from the Debian edition, dated March 8, 2022 β go forth and hash responsibly, ily, mwah πππ¦
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms