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 aMDC2_CTXstructure. 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 (lenbytes atdata). chunk by chunk, bite by bite, she's eating πMDC2_Final()β places the message digest inmd, which must have space forMDC2_DIGEST_LENGTH == 16bytes of output, and erases theMDC2_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()andMDC2_Final()return1for success,0otherwise. 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 π
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
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms