MD5(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’… MD5(3ossl) β€” the hash girlies (MD2, MD4, MD5) πŸ’…

okay so bestie, welcome to the ossl manual page for MD2, MD4, and MD5 hash functions ✨ β€” yes, this is the MD5(3ossl) page from the OpenSSL fam, and we're gonna get into it. lowkey this whole page is a throwback era though, so buckle up πŸŽ€


✨ NAME ✨

MD2, MD4, MD5, MD2_Init, MD2_Update, MD2_Final, MD4_Init, MD4_Update, MD4_Final, MD5_Init, MD5_Update, MD5_Final β€” MD2, MD4, and MD5 hash functions. that's the whole squad 🫢


🌸 SYNOPSIS 🌸

okay so the vibe check here is: all of this is deprecated since OpenSSL 3.0 😭 and you can hide it entirely by defining OPENSSL_API_COMPAT with a suitable version value β€” peep openssl_user_macros(7) for the deets.

first up, MD2:

#include <openssl/md2.h>

unsigned char *MD2(const unsigned char *d, unsigned long n, unsigned char *md);

int MD2_Init(MD2_CTX *c);
int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len);
int MD2_Final(unsigned char *md, MD2_CTX *c);

then MD4, same "deprecated since OpenSSL 3.0 / hide with OPENSSL_API_COMPAT / see openssl_user_macros(7)" situation πŸ’€:

#include <openssl/md4.h>

unsigned char *MD4(const unsigned char *d, unsigned long n, unsigned char *md);

int MD4_Init(MD4_CTX *c);
int MD4_Update(MD4_CTX *c, const void *data, unsigned long len);
int MD4_Final(unsigned char *md, MD4_CTX *c);

and finally MD5, besties, also deprecated since OpenSSL 3.0, also hideable via OPENSSL_API_COMPAT with a suitable version value, also see openssl_user_macros(7):

#include <openssl/md5.h>

unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);

int MD5_Init(MD5_CTX *c);
int MD5_Update(MD5_CTX *c, const void *data, unsigned long len);
int MD5_Final(unsigned char *md, MD5_CTX *c);

note how MD2_Update() takes const unsigned char *data but MD4_Update() and MD5_Update() take const void *data. that's not me being cute, that's literally the manpage. iykyk πŸ’…


πŸ’– DESCRIPTION πŸ’–

okay so first things first, main character warning:

all of the functions described on this page are deprecated. applications should instead use EVP_DigestInit_ex(3), EVP_DigestUpdate(3) and EVP_DigestFinal_ex(3). no cap. that's the actual recommendation, not me being dramatic for once πŸ™ˆ

MD2, MD4, and MD5 are cryptographic hash functions with a 128 bit output ⭐

MD2(), MD4(), and MD5() compute the MD2, MD4, and MD5 message digest of the n bytes at d and place it in md β€” and md must have space for MD2_DIGEST_LENGTH == MD4_DIGEST_LENGTH == MD5_DIGEST_LENGTH == 16 bytes of output. that equality chain is doing the most but it's iconic, they're all 16 πŸŽ€

and the fun part: if md is NULL, the digest is placed in a static array. you don't control it, she just lives there now πŸ¦‹


🧚 the streaming girlies πŸ’œ

the following functions may be used if the message is not completely stored in memory β€” literally what they're for:

  • MD2_Init() initializes a MD2_CTX structure.
  • MD2_Update() can be called repeatedly with chunks of the message to be hashed (len bytes at data).
  • MD2_Final() places the message digest in md, which must have space for MD2_DIGEST_LENGTH == 16 bytes of output, and erases the MD2_CTX. she's done, she's leaving, she's not coming back ✨

MD4_Init(), MD4_Update(), MD4_Final(), MD5_Init(), MD5_Update(), and MD5_Final() are analogous using an MD4_CTX and MD5_CTX structure. and listen β€” the parameter MUST NOT be NULL. i'm saying it in caps because the manpage says it in caps. respect it πŸ’€

applications should use the higher level functions EVP_DigestInit(3) etc. instead of calling the hash functions directly. yes, again. she's persistent πŸ’…


πŸ”₯ NOTE πŸ”₯

MD2, MD4, and MD5 are recommended only for compatibility with existing applications. for new applications, hashes from the SHA-2 or SHA-3 family should be preferred πŸ‘‘

fr fr, if you're starting something new in 2026 and reaching for MD5, bestie, we need to talk 😭 the page literally tells you to use SHA-2 or SHA-3. that's not a vibe, that's a directive.

⭐ RETURN VALUES ⭐

  • MD2(), MD4(), and MD5() return pointers to the hash value. slay.
  • MD2_Init(), MD2_Update(), MD2_Final(), MD4_Init(), MD4_Update(), MD4_Final(), MD5_Init(), MD5_Update(), and MD5_Final() return 1 for success, 0 otherwise.

that's it. 1 or 0. no in-between, no "it depends", very binary of them 🫢


🌈 CONFORMING TO 🌈

RFC 1319, RFC 1320, RFC 1321 β€” the holy trinity of MD specs, periodt πŸ“œ


πŸ¦‹ SEE ALSO πŸ¦‹

go read those, they're the upgraded versions of this whole page πŸ’–


πŸ‘‘ HISTORY πŸ‘‘

all of these functions were deprecated in OpenSSL 3.0. that's the whole history section. short, devastating, iconic πŸ’€


Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.


and that's the page, bestie!! πŸŽ€ this whole rewrite was brought to you by OpenSSL 3.5.0, dated 2026-09-25, and the original page name MD5(3ossl) β€” go forth, use EVP_DigestInit_ex(3), and hydrate πŸ’œβœ¨

πŸ“¦ where this page comes from