CRYPTO-C v1.1.3
C/C++ Documentation
sha1.h File Reference

Go to the source code of this file.

#include "utildev.h"

Detailed Description

SHA1 hash function support.

This file is based on Brad Conte's basic implementations of cryptography algorithms...

https://github.com/B-Con/crypto-algorithms

... and alterations to the transform function were based on Steve Reid's SHA1 implementation...

https://github.com/clibs/sha1

... both of which were released into the Public Domain.

Macros

#define SHA1LEN   20
 SHA1 message digest length, in bytes.
 

Data Structures

struct  SHA1_CTX
 

Functions

void sha1_init (SHA1_CTX *ctx)
 Initialize a SHA1 context. More...
 
void sha1_update (SHA1_CTX *ctx, const void *in, size_t inlen)
 Add inlen bytes from in to a SHA1 context for hashing. More...
 
void sha1_final (SHA1_CTX *ctx, void *out)
 Finalize a SHA1 message digest. More...
 
void sha1 (const void *in, size_t inlen, void *out)
 Convenient all-in-one SHA1 computation. More...
 

Function Documentation

◆ sha1()

void sha1 ( const void *  in,
size_t  inlen,
void *  out 
)

Convenient all-in-one SHA1 computation.

Performs sha1_init(), sha1_update() and sha1_final(), and places the resulting hash in out.

Parameters
inPointer to data to hash
inlenLength of in data, in bytes
outPointer to location to place the message digest

◆ sha1_final()

void sha1_final ( SHA1_CTX ctx,
void *  out 
)

Finalize a SHA1 message digest.

Generate the SHA1 message digest and place in out.

Parameters
ctxPointer to SHA1 context
outPointer to location to place the message digest

◆ sha1_init()

void sha1_init ( SHA1_CTX ctx)

Initialize a SHA1 context.

Parameters
ctxPointer to SHA1 context

◆ sha1_update()

void sha1_update ( SHA1_CTX ctx,
const void *  in,
size_t  inlen 
)

Add inlen bytes from in to a SHA1 context for hashing.

Parameters
ctxPointer to SHA1 context
inPointer to data to hash
inlenLength of in data, in bytes