MDC2_INIT(3SSL)

πŸ’– MDC2_INIT (3SSL) β€” the OpenSSL girlie's guide to MDC2 πŸ’–

okay so bestie. we need to talk. this page is about the MDC2 hash function and its little family of functions β€” MDC2, MDC2_Init, MDC2_Update, and MDC2_Final. and yes, the manual name up top is MDC2_INIT(3SSL) because that's just how OpenSSL names its pages, it's giving ✨legacy✨ vibes and honestly? we respect it.

but before you get attached: every single one of these functions is deprecated. like, deprecated since OpenSSL 3.0. we'll get there, bestie, don't panic πŸ’…


✨ SYNOPSIS ✨

first, the include. you need this header or nothing works, periodt:

#include <openssl/mdc2.h>

now here's the tea πŸ«– β€” the following functions have been deprecated since OpenSSL 3.0, and honestly you can hide them entirely by defining OPENSSL_API_COMPAT with a version value that suits your situation. see openssl_user_macros(7) for the deets.

and here are the signatures, verbatim, no cap:

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

int MDC2_Init(MDC2_CTX *c);
int MDC2_Update(MDC2_CTX *c, const unsigned char *data,
                unsigned long len);
int MDC2_Final(unsigned char *md, MDC2_CTX *c);

🌸 DESCRIPTION 🌸

all of the functions described on this page are deprecated. every. single. one. 😭

instead of using these, applications should use EVP_DigestInit_ex(3), EVP_DigestUpdate(3) and EVP_DigestFinal_ex(3). that's the main character path, bestie πŸŽ€

so. MDC2 is a method to construct hash functions with 128 bit output from block ciphers. these specific functions are an implementation of MDC2 with DES. iconic in a historical way, lowkey.

MDC2() computes the MDC2 message digest of the n bytes at d and places it in md β€” which must have space for MDC2_DIGEST_LENGTH == 16 bytes of output. yes, sixteen. sixteen is the number. don't skimp on the buffer, bestie, that's a one-way ticket to sadness πŸ’€

and get this β€” if md is NULL, the digest is placed in a static array. (a static array!! she's shared!! she's not yours alone!! πŸ™ˆ)

the following functions may be used if the message is not completely stored in memory:

  • MDC2_Init() β€” initializes a MDC2_CTX structure. like, waking her up, doing her little skincare routine, getting her ready to receive data πŸ§–
  • MDC2_Update() β€” can be called repeatedly with chunks of the message to be hashed (len bytes at data). chunk by chunk, bite by bite, she's eating πŸ“
  • MDC2_Final() β€” places the message digest in md, which must have space for MDC2_DIGEST_LENGTH == 16 bytes of output, and erases the MDC2_CTX. she's done, she's leaving, she's wiping her own memory on the way out. that's called closure πŸ’…
applications should use the higher level functions EVP_DigestInit(3) etc. instead of calling the hash functions directly. fr fr.

πŸ’« RETURN VALUES πŸ’«

  • MDC2() returns a pointer to the hash value. she hands you the goods πŸ‘‘
  • MDC2_Init(), MDC2_Update() and MDC2_Final() return 1 for success, 0 otherwise. binary. no in-between. no "maybe". slay or don't ✨

🌈 CONFORMING TO 🌈

ISO/IEC 10118-2:2000 Hash-Function 2, with DES as the underlying block cipher. she's certified!! she's got papers!! she's standards-compliant and she wants you to know it πŸ“œ


πŸ¦‹ SEE ALSO πŸ¦‹

  • EVP_DigestInit(3) β€” the one you should actually be calling, bestie. go read that one next. iykyk 🫢

πŸŽ€ HISTORY πŸŽ€

all of these functions were deprecated in OpenSSL 3.0. that's the whole history section. short, sweet, and a little tragic πŸ’”


Copyright 2000-2020 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 whole page, babe 🫢 this was version 4.0.3, dated 2026-09-29, from the OpenSSL crew. now go use EVP_DigestInit_ex(3) like a responsible icon and leave MDC2 in the past where she belongs πŸ’–βœ¨ no cap.

πŸ“¦ where this page comes from