lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | =pod |
| 2 | |
| 3 | =head1 NAME |
| 4 | |
| 5 | MD2, MD4, MD5, MD2_Init, MD2_Update, MD2_Final, MD4_Init, MD4_Update, |
| 6 | MD4_Final, MD5_Init, MD5_Update, MD5_Final - MD2, MD4, and MD5 hash functions |
| 7 | |
| 8 | =head1 SYNOPSIS |
| 9 | |
| 10 | #include <openssl/md2.h> |
| 11 | |
| 12 | unsigned char *MD2(const unsigned char *d, unsigned long n, unsigned char *md); |
| 13 | |
| 14 | int MD2_Init(MD2_CTX *c); |
| 15 | int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len); |
| 16 | int MD2_Final(unsigned char *md, MD2_CTX *c); |
| 17 | |
| 18 | |
| 19 | #include <openssl/md4.h> |
| 20 | |
| 21 | unsigned char *MD4(const unsigned char *d, unsigned long n, unsigned char *md); |
| 22 | |
| 23 | int MD4_Init(MD4_CTX *c); |
| 24 | int MD4_Update(MD4_CTX *c, const void *data, unsigned long len); |
| 25 | int MD4_Final(unsigned char *md, MD4_CTX *c); |
| 26 | |
| 27 | |
| 28 | #include <openssl/md5.h> |
| 29 | |
| 30 | unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md); |
| 31 | |
| 32 | int MD5_Init(MD5_CTX *c); |
| 33 | int MD5_Update(MD5_CTX *c, const void *data, unsigned long len); |
| 34 | int MD5_Final(unsigned char *md, MD5_CTX *c); |
| 35 | |
| 36 | =head1 DESCRIPTION |
| 37 | |
| 38 | MD2, MD4, and MD5 are cryptographic hash functions with a 128 bit output. |
| 39 | |
| 40 | MD2(), MD4(), and MD5() compute the MD2, MD4, and MD5 message digest |
| 41 | of the B<n> bytes at B<d> and place it in B<md> (which must have space |
| 42 | for MD2_DIGEST_LENGTH == MD4_DIGEST_LENGTH == MD5_DIGEST_LENGTH == 16 |
| 43 | bytes of output). If B<md> is NULL, the digest is placed in a static |
| 44 | array. |
| 45 | |
| 46 | The following functions may be used if the message is not completely |
| 47 | stored in memory: |
| 48 | |
| 49 | MD2_Init() initializes a B<MD2_CTX> structure. |
| 50 | |
| 51 | MD2_Update() can be called repeatedly with chunks of the message to |
| 52 | be hashed (B<len> bytes at B<data>). |
| 53 | |
| 54 | MD2_Final() places the message digest in B<md>, which must have space |
| 55 | for MD2_DIGEST_LENGTH == 16 bytes of output, and erases the B<MD2_CTX>. |
| 56 | |
| 57 | MD4_Init(), MD4_Update(), MD4_Final(), MD5_Init(), MD5_Update(), and |
| 58 | MD5_Final() are analogous using an B<MD4_CTX> and B<MD5_CTX> structure. |
| 59 | |
| 60 | Applications should use the higher level functions |
| 61 | L<EVP_DigestInit(3)> |
| 62 | etc. instead of calling the hash functions directly. |
| 63 | |
| 64 | =head1 NOTE |
| 65 | |
| 66 | MD2, MD4, and MD5 are recommended only for compatibility with existing |
| 67 | applications. In new applications, SHA-1 or RIPEMD-160 should be |
| 68 | preferred. |
| 69 | |
| 70 | =head1 RETURN VALUES |
| 71 | |
| 72 | MD2(), MD4(), and MD5() return pointers to the hash value. |
| 73 | |
| 74 | MD2_Init(), MD2_Update(), MD2_Final(), MD4_Init(), MD4_Update(), |
| 75 | MD4_Final(), MD5_Init(), MD5_Update(), and MD5_Final() return 1 for |
| 76 | success, 0 otherwise. |
| 77 | |
| 78 | =head1 CONFORMING TO |
| 79 | |
| 80 | RFC 1319, RFC 1320, RFC 1321 |
| 81 | |
| 82 | =head1 SEE ALSO |
| 83 | |
| 84 | L<EVP_DigestInit(3)> |
| 85 | |
| 86 | =head1 COPYRIGHT |
| 87 | |
| 88 | Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved. |
| 89 | |
| 90 | Licensed under the OpenSSL license (the "License"). You may not use |
| 91 | this file except in compliance with the License. You can obtain a copy |
| 92 | in the file LICENSE in the source distribution or at |
| 93 | L<https://www.openssl.org/source/license.html>. |
| 94 | |
| 95 | =cut |