SHA1 Class Reference

This class represents the implementation of the sha1 algorithm. More...

#include <hl_sha1.h>

List of all members.

Public Member Functions

int SHA1Reset (HL_SHA1_CTX *context)
 Resets the sha1 context and starts a new hashprocess.
int SHA1Input (HL_SHA1_CTX *context, const hl_uint8 *message_array, unsigned int length)
 Data input.
int SHA1Result (HL_SHA1_CTX *context, hl_uint8 Message_Digest[SHA1HashSize])
 This ends the sha operation, zeroizing the context and returning the computed hash.

Private Member Functions

void SHA1PadMessage (HL_SHA1_CTX *context)
 Internal method to padd the message.
void SHA1ProcessMessageBlock (HL_SHA1_CTX *context)
 This member-function will process the next 512 bits of the message stored in the Message_Block array.

Detailed Description

This class represents the implementation of the sha1 algorithm.

Basically the class provides three public member-functions to create a hash: SHA1Reset(), SHA1Input() and SHA1Result(). If you want to create a hash based on a string or file quickly you should use the sha1wrapper class instead of SHA1.


Member Function Documentation

int SHA1::SHA1Input ( HL_SHA1_CTX context,
const hl_uint8 message_array,
unsigned int  length 
)

Data input.

This memberfunction add data to the specified context.

Parameters:
context The context to add data to
message_array The data to add
length The length of the data to add
void SHA1::SHA1PadMessage ( HL_SHA1_CTX context  )  [private]

Internal method to padd the message.

According to the standard, the message must be padded to an even 512 bits. The first padding bit must be a '1'. The last 64 bits represent the length of the original message. All bits in between should be 0. This function will pad the message according to those rules by filling the Message_Block array accordingly. It will also call the ProcessMessageBlock function provided appropriately. When it returns, it can be assumed that the message digest has been computed.

Parameters:
context The context to padd
void SHA1::SHA1ProcessMessageBlock ( HL_SHA1_CTX context  )  [private]

This member-function will process the next 512 bits of the message stored in the Message_Block array.

Many of the variable names in this code, especially the single character names, were used because those were the names used in the publication.

Parameters:
context The context to process
int SHA1::SHA1Reset ( HL_SHA1_CTX context  ) 

Resets the sha1 context and starts a new hashprocess.

Parameters:
context The context to reset
Returns:
0 on succes an error number otherwise
int SHA1::SHA1Result ( HL_SHA1_CTX context,
hl_uint8  Message_Digest[SHA1HashSize] 
)

This ends the sha operation, zeroizing the context and returning the computed hash.

Parameters:
context The context to get the hash from
Message_Digest This is an OUT parameter which contains the hash after the menberfunction returns
Returns:
0 on succes, an error-code otherwise

The documentation for this class was generated from the following files:
Generated on Thu Oct 13 20:06:35 2011 for hashlib++ by  doxygen 1.6.3