MD5(3ossl)
π 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 useEVP_DigestInit_ex(3),EVP_DigestUpdate(3)andEVP_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 aMD2_CTXstructure.MD2_Update()can be called repeatedly with chunks of the message to be hashed (lenbytes atdata).MD2_Final()places the message digest inmd, which must have space forMD2_DIGEST_LENGTH == 16bytes of output, and erases theMD2_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(), andMD5()return pointers to the hash value. slay.MD2_Init(),MD2_Update(),MD2_Final(),MD4_Init(),MD4_Update(),MD4_Final(),MD5_Init(),MD5_Update(), andMD5_Final()return1for success,0otherwise.
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 π
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
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms