---
name: "CC_MD5"
section: "3cc"
platform: "macos"
package: "CommonCrypto"
version: "600035"
release: "macOS 26.5"
platforms: ["macos"]
url: "https://new.carta.tech/CC_MD5"
---

# CC\_MD5(3cc)

MD2, MD4, and MD5 hash functions

## NAME

**CC\_MD2\_Init** **CC\_MD2\_Update** **CC\_MD2\_Final** **CC\_MD2**

**CC\_MD4\_Init** **CC\_MD4\_Update** **CC\_MD4\_Final** **CC\_MD4**

**CC\_MD5\_Init** **CC\_MD5\_Update** **CC\_MD5\_Final** **CC\_MD5**

– MD2, MD4, and MD5 hash functions

## SYNOPSIS

**#include \<CommonCrypto/CommonDigest.h\>**

*extern* *int*\

**CC\_MD2\_Init**(*CC\_MD2\_CTX \*c*);

*extern* *int*\

**CC\_MD2\_Update**(*CC\_MD2\_CTX \*c*, *const void \*data*, *CC\_LONG len*);

*extern* *int*\

**CC\_MD2\_Final**(*unsigned char \*md*, *CC\_MD2\_CTX \*c*);

*extern* *unsigned* *char* *\**\

**CC\_MD2**(*const void \*data*, *CC\_LONG len*, *unsigned char \*md*);

*extern* *int*\

**CC\_MD4\_Init**(*CC\_MD4\_CTX \*c*);

*extern* *int*\

**CC\_MD4\_Update**(*CC\_MD4\_CTX \*c*, *const void \*data*, *CC\_LONG len*);

*extern* *int*\

**CC\_MD4\_Final**(*unsigned char \*md*, *CC\_MD4\_CTX \*c*);

*extern* *unsigned* *char* *\**\

**CC\_MD4**(*const void \*data*, *CC\_LONG len*, *unsigned char \*md*);

*extern* *int*\

**CC\_MD5\_Init**(*CC\_MD5\_CTX \*c*);

*extern* *int*\

**CC\_MD5\_Update**(*CC\_MD5\_CTX \*c*, *const void \*data*, *CC\_LONG len*);

*extern* *int*\

**CC\_MD5\_Final**(*unsigned char \*md*, *CC\_MD5\_CTX \*c*);

*extern* *unsigned* *char* *\**\

**CC\_MD5**(*const void \*data*, *CC\_LONG len*, *unsigned char \*md*);

## DESCRIPTION

The following functions are used to produce an hash from data:

**CC\_MD2\_Init**() initializes a  *CC\_MD2\_CTX* structure.

**CC\_MD2\_Update**() can be called repeatedly with chunks of the message to be hashed (len bytes at data).

**CC\_MD2\_Final**() places the MD2 message digest in md, which must have space for  *CC\_MD2\_DIGEST\_LENGTH* == 16 bytes of output, and erases the  *CC\_MD2\_CTX*.

**CC\_MD2**() computes the MD2 message digest of the len bytes at data and places it in md (which must have space for *CC\_MD2\_DIGEST\_LENGTH* == 16 bytes of output). It returns the md pointer.

**CC\_MD4\_Init**(), **CC\_MD4\_Update**(), **CC\_MD4\_Final**(), **CC\_MD4**(), **CC\_MD5\_Init**(), **CC\_MD5\_Update**(), **CC\_MD5\_Final**(), and  **CC\_MD5**() are analogous using an  *CC\_MD4\_CTX* and  *CC\_MD5\_CTX* structure.

## NOTE

MD2, MD4, and MD5 are recommended only for compatibility with existing applications. In new applications, SHA-256(or greater) should be preferred.

## RETURN VALUES

All routines return 1 upon success and NULL upon failure, except for the one-shot routines ( **CC\_MD2**() , etc.), which return the pointer passed in via the md parameter.

## CONFORMING TO

RFC 1319, RFC 1320, RFC 1321

## SEE ALSO

[CC\_crypto(3cc)](/CC_crypto/3cc.md), [CC\_SHA(3cc)](/CC_SHA/3cc.md), [CCHmac(3cc)](/CCHmac/3cc.md), [CCCryptor(3cc)](/CCCryptor/3cc.md)

## HISTORY

These functions are available in OS X 10.4 and later.

These functions provide similar functionality to the routines found in OpenSSL 0.9.6 and may use the same implementation.
