SHA1

You shouldn’t use this for anything new.

Macros

CF_SHA1_HASHSZ

The output size of SHA1: 20 bytes.

CF_SHA1_BLOCKSZ

The block size of SHA1: 64 bytes.

Types

cf_sha1_context

Incremental SHA1 hashing context.

cf_sha1_context.H

Intermediate values.

cf_sha1_context.partial

Unprocessed input.

cf_sha1_context.npartial

Number of bytes of unprocessed input.

cf_sha1_context.blocks

Number of full blocks processed.

Functions

void cf_sha1_init(cf_sha1_context *ctx)

Sets up ctx ready to hash a new message.

void cf_sha1_update(cf_sha1_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_sha1_digest(const cf_sha1_context *ctx, uint8_t hash[CF_SHA1_HASHSZ])

Finishes the hash operation, writing CF_SHA1_HASHSZ bytes to hash.

This leaves ctx unchanged.

void cf_sha1_digest_final(cf_sha1_context *ctx, uint8_t hash[CF_SHA1_HASHSZ])

Finishes the hash operation, writing CF_SHA1_HASHSZ bytes to hash.

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

Values

cf_sha1

Abstract interface to SHA1. See cf_chash for more information.