Manpage Monday: CC_SHA(3cc)
The Common Crypto library in Mac OS X 10.4 and later provides simple APIs for five SHA algorithms:
CC_SHA1()computes the SHA-1 message digest of thelenbytes atdataand places it inmd(which must have space forCC_SHA1_DIGEST_LENGTH== 20 bytes of output). It returns themdpointer.
CC_SHA1_Init()initializes aCC_SHA1_CTXstructure.
CC_SHA1_Update()can be called repeatedly with chunks of the message to be hashed (lenbytes atdata).
CC_SHA1_Final()places the message digest inmd, which must have space forCC_SHA1_DIGEST_LENGTH== 20 bytes of output, and erases theCC_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: …
RETURN VALUES
All routines return 1 except for the one-shot routines (
CC_SHA1(), etc.), which return the pointer passed in via themdparameter.