ADC Home > Reference Library > Reference > Mac OS X > Mac OS X Man Pages

 

This document is a Mac OS X manual page. Manual pages are a command-line technology for providing documentation. You can view these manual pages locally using the man(1) command. These manual pages come from many different sources, and thus, have a variety of writing styles.

For more information about the manual page format, see the manual page for manpages(5).



CC_SHA(3cc)                          LOCAL                         CC_SHA(3cc)

NAME
     CC_SHA1_Init CC_SHA1_Update CC_SHA1_Final CC_SHA1

     CC_SHA224_Init CC_SHA224_Update CC_SHA224_Final CC_SHA224

     CC_SHA256_Init CC_SHA256_Update CC_SHA256_Final CC_SHA256

     CC_SHA384_Init CC_SHA384_Update CC_SHA384_Final CC_SHA384

     CC_SHA512_Init CC_SHA512_Update CC_SHA512_Final CC_SHA512

     -- Secure Hash Algorithms

SYNOPSIS
     #include <CommonCrypto/CommonDigest.h>

     extern int
     CC_SHA1_Init(CC_SHA1_CTX *c);

     extern int
     CC_SHA1_Update(CC_SHA1_CTX *c, const void *data, CC_LONG len);

     extern int
     CC_SHA1_Final(unsigned char *md, CC_SHA1_CTX *c);

     extern unsigned char *
     CC_SHA1(const void *data, CC_LONG len, unsigned char *md);

     extern int
     CC_SHA224_Init(CC_SHA224_CTX *c);

     extern int
     CC_SHA224_Update(CC_SHA224_CTX *c, const void *data, CC_LONG len);

     extern int
     CC_SHA224_Final(unsigned char *md, CC_SHA224_CTX *c);

     extern unsigned char *
     CC_SHA224(const void *data, CC_LONG len, unsigned char *md);

     extern int
     CC_SHA256_Init(CC_SHA256_CTX *c);

     extern int
     CC_SHA256_Update(CC_SHA256_CTX *c, const void *data, CC_LONG len);

     extern int
     CC_SHA256_Final(unsigned char *md, CC_SHA256_CTX *c);

     extern unsigned char *
     CC_SHA256(const void *data, CC_LONG len, unsigned char *md);

     extern int
     CC_SHA384_Init(CC_SHA384_CTX *c);

     extern int
     CC_SHA384_Update(CC_SHA384_CTX *c, const void *data, CC_LONG len);

     extern int
     CC_SHA384_Final(unsigned char *md, CC_SHA384_CTX *c);

     extern unsigned char *
     CC_SHA384(const void *data, CC_LONG len, unsigned char *md);

     extern int
     CC_SHA512_Init(CC_SHA512_CTX *c);

     extern int
     CC_SHA512_Update(CC_SHA512_CTX *c, const void *data, CC_LONG len);

     extern int
     CC_SHA512_Final(unsigned char *md, CC_SHA512_CTX *c);

     extern unsigned char *
     CC_SHA512(const void *data, CC_LONG len, unsigned char *md);

DESCRIPTION
     SHA-1 (Secure Hash Algorithm) is a cryptographic hash function with a 160 bit output.

     CC_SHA1() computes the SHA-1 message digest of the len bytes at data and places it in md (which must
     have space for CC_SHA1_DIGEST_LENGTH == 20 bytes of output). It returns the md pointer.

     CC_SHA1_Init() initializes a CC_SHA1_CTX structure.

     CC_SHA1_Update() can be called repeatedly with chunks of the message to be hashed (len bytes at data).

     CC_SHA1_Final() places the message digest in md, which must have space for CC_SHA1_DIGEST_LENGTH == 20
     bytes of output, and erases the CC_SHA1_CTX.

     The successor versions of SHA-1, SHA-2, are also implemented for hash bit lengths of 224, 256, 384, and
     512.  The functions to call to invoke the larger hash-size versions of the algorithms include the hash
     size as part of the function names:

     CC_SHA224_Init(), CC_SHA224_Update(), CC_SHA224_Final(), CC_SHA224()

     CC_SHA256_Init(), CC_SHA256_Update(), CC_SHA256_Final(), CC_SHA256()

     CC_SHA384_Init(), CC_SHA384_Update(), CC_SHA384_Final(), CC_SHA384()

     CC_SHA512_Init(), CC_SHA512_Update(), CC_SHA512_Final(), CC_SHA512()

RETURN VALUES
     All routines return 1 except for the one-shot routines ( CC_SHA1(), etc.), which return the pointer
     passed in via the md parameter.

CONFORMING TO
     SHA-1: US Federal Information Processing Standard FIPS PUB 180-1 (Secure Hash Standard), ANSI X9.30

     SHA-2: US Federal Information Processing Standard FIPS PUB 180-2 (Secure Hash Standard)

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.

SEE ALSO
     CC_MD5(3cc), CCCryptor(3cc), CCHmac(3cc), CC_crypto(3cc)

BSD                              April 5, 2007                             BSD

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.