SHA224/SHA256

Macros

CF_SHA224_HASHSZ

The output size of SHA224: 28 bytes.

CF_SHA224_BLOCKSZ

The block size of SHA224: 64 bytes.

CF_SHA256_HASHSZ

The output size of SHA256: 32 bytes.

CF_SHA256_BLOCKSZ

The block size of SHA256: 64 bytes.

Types

cf_sha256_context

Incremental SHA256 hashing context.

cf_sha256_context.H

Intermediate values.

cf_sha256_context.partial

Unprocessed input.

cf_sha256_context.npartial

Number of bytes of unprocessed input.

cf_sha256_context.blocks

Number of full blocks processed.

Functions

void cf_sha256_init(cf_sha256_context *ctx)

Sets up ctx ready to hash a new message.

void cf_sha256_update(cf_sha256_context *ctx, const void *data, size_t nbytes)

Hashes nbytes at data. Copies the data if there isn’t enough to make a full block.

void cf_sha256_digest(const cf_sha256_context *ctx, uint8_t hash[CF_SHA256_HASHSZ])

Finishes the hash operation, writing CF_SHA256_HASHSZ bytes to hash.

This leaves ctx unchanged.

void cf_sha256_digest_final(cf_sha256_context *ctx, uint8_t hash[CF_SHA256_HASHSZ])

Finishes the hash operation, writing CF_SHA256_HASHSZ bytes to hash.

This destroys ctx, but uses less stack than cf_sha256_digest().

void cf_sha224_init(cf_sha256_context *ctx)

Sets up ctx ready to hash a new message.

nb. SHA224 uses SHA256’s underlying types.

void cf_sha224_update(cf_sha256_context *ctx, const void *data, size_t nbytes)

Hashes nbytes at data. Copies the data if there isn’t enough to make a full block.

void cf_sha224_digest(const cf_sha256_context *ctx, uint8_t hash[CF_SHA224_HASHSZ])

Finishes the hash operation, writing CF_SHA224_HASHSZ bytes to hash.

This leaves ctx unchanged.

void cf_sha224_digest_final(cf_sha256_context *ctx, uint8_t hash[CF_SHA224_HASHSZ])

Finishes the hash operation, writing CF_SHA224_HASHSZ bytes to hash.

This destroys ctx, but uses less stack than cf_sha224_digest().

Values

cf_sha224

Abstract interface to SHA224. See cf_chash for more information.

cf_sha256

Abstract interface to SHA256. See cf_chash for more information.

SHA384/SHA512

Macros

CF_SHA384_HASHSZ

The output size of SHA384: 48 bytes.

CF_SHA384_BLOCKSZ

The block size of SHA384: 128 bytes.

CF_SHA512_HASHSZ

The output size of SHA512: 64 bytes.

CF_SHA512_BLOCKSZ

The block size of SHA512: 128 bytes.

Types

cf_sha512_context

Incremental SHA512 hashing context.

cf_sha512_context.H

Intermediate values.

cf_sha512_context.partial

Unprocessed input.

cf_sha512_context.npartial

Number of bytes of unprocessed input.

cf_sha512_context.blocks

Number of full blocks processed.

Functions

void cf_sha512_init(cf_sha512_context *ctx)

Sets up ctx ready to hash a new message.

void cf_sha512_update(cf_sha512_context *ctx, const void *data, size_t nbytes)

Hashes nbytes at data. Copies the data if there isn’t enough to make a full block.

void cf_sha512_digest(const cf_sha512_context *ctx, uint8_t hash[CF_SHA512_HASHSZ])

Finishes the hash operation, writing CF_SHA512_HASHSZ bytes to hash.

This leaves ctx unchanged.

void cf_sha512_digest_final(cf_sha512_context *ctx, uint8_t hash[CF_SHA512_HASHSZ])

Finishes the hash operation, writing CF_SHA512_HASHSZ bytes to hash.

This destroys ctx, but uses less stack than cf_sha512_digest().

void cf_sha384_init(cf_sha512_context *ctx)

Sets up ctx ready to hash a new message.

nb. SHA384 uses SHA512’s underlying types.

void cf_sha384_update(cf_sha512_context *ctx, const void *data, size_t nbytes)

Hashes nbytes at data. Copies the data if there isn’t enough to make a full block.

void cf_sha384_digest(const cf_sha512_context *ctx, uint8_t hash[CF_SHA384_HASHSZ])

Finishes the hash operation, writing CF_SHA384_HASHSZ bytes to hash.

This leaves ctx unchanged.

void cf_sha384_digest_final(cf_sha512_context *ctx, uint8_t hash[CF_SHA384_HASHSZ])

Finishes the hash operation, writing CF_SHA384_HASHSZ bytes to hash.

This destroys ctx, but uses less stack than cf_sha384_digest().

Values

cf_sha384

Abstract interface to SHA384. See cf_chash for more information.

cf_sha512

Abstract interface to SHA512. See cf_chash for more information.