libfossil
fsl_sha1_cx Struct Reference

Holds state for SHA1 calculations. More...

#include "hash.h"

Collaboration diagram for fsl_sha1_cx:

Data Fields

unsigned char buffer [64]
unsigned int count [2]
unsigned int state [5]

Detailed Description

Holds state for SHA1 calculations.

It is intended to be used like this:

unsigned char digest[FSL_STRLEN_SHA1/2]
char hex[FSL_STRLEN_SHA1+1];
fsl_sha1_init(&cx); // REQUIRED, unlike its md5 counterpart
...call fsl_sha1_update(&cx,...) any number of times to
...incrementally calculate the hash.
fsl_sha1_final(&cx, digest); // ends the calculation
// digest now contains the raw 20-byte SHA1 digest.
// hex now contains the 40-byte SHA1 + a trailing NUL
FSL_EXPORT void fsl_sha1_update(fsl_sha1_cx *context, void const *data, fsl_size_t len)
Updates the given context to include the hash of the first len bytes of the given data.
FSL_EXPORT void fsl_sha1_init(fsl_sha1_cx *context)
Initializes the given context with the initial SHA1 state.
FSL_EXPORT void fsl_sha1_digest_to_base16(unsigned char const *digest, char *zBuf)
Convert a digest into base-16.
@ FSL_STRLEN_SHA1
The length, in bytes, of a hex-format SHA1 hash string.
Definition hash.h:33
FSL_EXPORT int fsl_sha1_final(fsl_sha1_cx *context, unsigned char *digest)
Add padding and finalizes the message digest.
Holds state for SHA1 calculations.
Definition hash.h:251

Definition at line 251 of file hash.h.

Field Documentation

◆ buffer

unsigned char fsl_sha1_cx::buffer[64]

Definition at line 271 of file hash.h.

◆ count

unsigned int fsl_sha1_cx::count[2]

Definition at line 270 of file hash.h.

◆ state

unsigned int fsl_sha1_cx::state[5]

Definition at line 269 of file hash.h.


The documentation for this struct was generated from the following file: