Data Structures | Functions

sha1.h File Reference

Routines for computing SHA1 checksums. More...

#include "int_sizes.h"

Go to the source code of this file.

Data Structures

struct  sha1_context_t

Functions

void sha1_buffer (const char *buffer, int length, unsigned char digest[SHA1_DIGEST_LENGTH])
 Checksum a memory buffer.
int sha1_file (const char *filename, unsigned char digest[SHA1_DIGEST_LENGTH])
 Checksum a local file.
const char * sha1_string (unsigned char digest[SHA1_DIGEST_LENGTH])
 Convert an SHA1 digest into a printable string.

Detailed Description

Routines for computing SHA1 checksums.


Function Documentation

void sha1_buffer ( const char *  buffer,
int  length,
unsigned char  digest[SHA1_DIGEST_LENGTH] 
)

Checksum a memory buffer.

Note that this function produces a digest in binary form which must be converted to a human readable form with sha1_string.

Parameters:
buffer Pointer to a memory buffer.
length Length of the buffer in bytes.
digest Pointer to a buffer to store the digest.
int sha1_file ( const char *  filename,
unsigned char  digest[SHA1_DIGEST_LENGTH] 
)

Checksum a local file.

Note that this function produces a digest in binary form which must be converted to a human readable form with sha1_string.

Parameters:
filename Path to the file to checksum.
digest Pointer to a buffer to store the digest.
Returns:
One on success, zero on failure.
const char* sha1_string ( unsigned char  digest[SHA1_DIGEST_LENGTH]  ) 

Convert an SHA1 digest into a printable string.

Parameters:
digest A binary digest returned from sha1_file.
Returns:
A static pointer to a human readable form of the digest.