1e71b7053SJung-uk Kim=pod 2e71b7053SJung-uk Kim 3e71b7053SJung-uk Kim=head1 NAME 4e71b7053SJung-uk Kim 5e71b7053SJung-uk KimMD2, MD4, MD5, MD2_Init, MD2_Update, MD2_Final, MD4_Init, MD4_Update, 6e71b7053SJung-uk KimMD4_Final, MD5_Init, MD5_Update, MD5_Final - MD2, MD4, and MD5 hash functions 7e71b7053SJung-uk Kim 8e71b7053SJung-uk Kim=head1 SYNOPSIS 9e71b7053SJung-uk Kim 10b077aed3SPierre ProncheryThe following functions have been deprecated since OpenSSL 3.0, and can be 11b077aed3SPierre Proncheryhidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value, 12b077aed3SPierre Proncherysee L<openssl_user_macros(7)>: 13b077aed3SPierre Pronchery 14*a7148ab3SEnji Cooper #include <openssl/md2.h> 15*a7148ab3SEnji Cooper 16e71b7053SJung-uk Kim unsigned char *MD2(const unsigned char *d, unsigned long n, unsigned char *md); 17e71b7053SJung-uk Kim 18e71b7053SJung-uk Kim int MD2_Init(MD2_CTX *c); 19e71b7053SJung-uk Kim int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len); 20e71b7053SJung-uk Kim int MD2_Final(unsigned char *md, MD2_CTX *c); 21e71b7053SJung-uk Kim 22e71b7053SJung-uk Kim 23b077aed3SPierre ProncheryThe following functions have been deprecated since OpenSSL 3.0, and can be 24b077aed3SPierre Proncheryhidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value, 25b077aed3SPierre Proncherysee L<openssl_user_macros(7)>: 26b077aed3SPierre Pronchery 27*a7148ab3SEnji Cooper #include <openssl/md4.h> 28*a7148ab3SEnji Cooper 29e71b7053SJung-uk Kim unsigned char *MD4(const unsigned char *d, unsigned long n, unsigned char *md); 30e71b7053SJung-uk Kim 31e71b7053SJung-uk Kim int MD4_Init(MD4_CTX *c); 32e71b7053SJung-uk Kim int MD4_Update(MD4_CTX *c, const void *data, unsigned long len); 33e71b7053SJung-uk Kim int MD4_Final(unsigned char *md, MD4_CTX *c); 34e71b7053SJung-uk Kim 35b077aed3SPierre ProncheryThe following functions have been deprecated since OpenSSL 3.0, and can be 36b077aed3SPierre Proncheryhidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value, 37b077aed3SPierre Proncherysee L<openssl_user_macros(7)>: 38b077aed3SPierre Pronchery 39*a7148ab3SEnji Cooper #include <openssl/md5.h> 40*a7148ab3SEnji Cooper 41e71b7053SJung-uk Kim unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md); 42e71b7053SJung-uk Kim 43e71b7053SJung-uk Kim int MD5_Init(MD5_CTX *c); 44e71b7053SJung-uk Kim int MD5_Update(MD5_CTX *c, const void *data, unsigned long len); 45e71b7053SJung-uk Kim int MD5_Final(unsigned char *md, MD5_CTX *c); 46e71b7053SJung-uk Kim 47e71b7053SJung-uk Kim=head1 DESCRIPTION 48e71b7053SJung-uk Kim 49b077aed3SPierre ProncheryAll of the functions described on this page are deprecated. 50b077aed3SPierre ProncheryApplications should instead use L<EVP_DigestInit_ex(3)>, L<EVP_DigestUpdate(3)> 51b077aed3SPierre Proncheryand L<EVP_DigestFinal_ex(3)>. 52b077aed3SPierre Pronchery 53e71b7053SJung-uk KimMD2, MD4, and MD5 are cryptographic hash functions with a 128 bit output. 54e71b7053SJung-uk Kim 55e71b7053SJung-uk KimMD2(), MD4(), and MD5() compute the MD2, MD4, and MD5 message digest 56e71b7053SJung-uk Kimof the B<n> bytes at B<d> and place it in B<md> (which must have space 57e71b7053SJung-uk Kimfor MD2_DIGEST_LENGTH == MD4_DIGEST_LENGTH == MD5_DIGEST_LENGTH == 16 58e71b7053SJung-uk Kimbytes of output). If B<md> is NULL, the digest is placed in a static 59e71b7053SJung-uk Kimarray. 60e71b7053SJung-uk Kim 61e71b7053SJung-uk KimThe following functions may be used if the message is not completely 62e71b7053SJung-uk Kimstored in memory: 63e71b7053SJung-uk Kim 64e71b7053SJung-uk KimMD2_Init() initializes a B<MD2_CTX> structure. 65e71b7053SJung-uk Kim 66e71b7053SJung-uk KimMD2_Update() can be called repeatedly with chunks of the message to 67e71b7053SJung-uk Kimbe hashed (B<len> bytes at B<data>). 68e71b7053SJung-uk Kim 69e71b7053SJung-uk KimMD2_Final() places the message digest in B<md>, which must have space 70e71b7053SJung-uk Kimfor MD2_DIGEST_LENGTH == 16 bytes of output, and erases the B<MD2_CTX>. 71e71b7053SJung-uk Kim 72e71b7053SJung-uk KimMD4_Init(), MD4_Update(), MD4_Final(), MD5_Init(), MD5_Update(), and 73e71b7053SJung-uk KimMD5_Final() are analogous using an B<MD4_CTX> and B<MD5_CTX> structure. 74e71b7053SJung-uk Kim 75e71b7053SJung-uk KimApplications should use the higher level functions 76e71b7053SJung-uk KimL<EVP_DigestInit(3)> 77e71b7053SJung-uk Kimetc. instead of calling the hash functions directly. 78e71b7053SJung-uk Kim 79e71b7053SJung-uk Kim=head1 NOTE 80e71b7053SJung-uk Kim 81e71b7053SJung-uk KimMD2, MD4, and MD5 are recommended only for compatibility with existing 82b077aed3SPierre Proncheryapplications. In new applications, hashes from the SHA-2 or SHA-3 family 83b077aed3SPierre Proncheryshould be preferred. 84e71b7053SJung-uk Kim 85e71b7053SJung-uk Kim=head1 RETURN VALUES 86e71b7053SJung-uk Kim 87e71b7053SJung-uk KimMD2(), MD4(), and MD5() return pointers to the hash value. 88e71b7053SJung-uk Kim 89e71b7053SJung-uk KimMD2_Init(), MD2_Update(), MD2_Final(), MD4_Init(), MD4_Update(), 90e71b7053SJung-uk KimMD4_Final(), MD5_Init(), MD5_Update(), and MD5_Final() return 1 for 91e71b7053SJung-uk Kimsuccess, 0 otherwise. 92e71b7053SJung-uk Kim 93e71b7053SJung-uk Kim=head1 CONFORMING TO 94e71b7053SJung-uk Kim 95e71b7053SJung-uk KimRFC 1319, RFC 1320, RFC 1321 96e71b7053SJung-uk Kim 97e71b7053SJung-uk Kim=head1 SEE ALSO 98e71b7053SJung-uk Kim 99b077aed3SPierre ProncheryL<EVP_DigestInit(3)>, L<EVP_MD-SHA2(7)>, L<EVP_MD-SHA3(7)> 100b077aed3SPierre Pronchery 101b077aed3SPierre Pronchery=head1 HISTORY 102b077aed3SPierre Pronchery 103b077aed3SPierre ProncheryAll of these functions were deprecated in OpenSSL 3.0. 104e71b7053SJung-uk Kim 105e71b7053SJung-uk Kim=head1 COPYRIGHT 106e71b7053SJung-uk Kim 107*a7148ab3SEnji CooperCopyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. 108e71b7053SJung-uk Kim 109b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 110e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 111e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 112e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 113e71b7053SJung-uk Kim 114e71b7053SJung-uk Kim=cut 115