# CSHA1 Class Reference

`#include <SHA1.h>`

List of all members.

## Public Types

enum | { REPORT_HEX = 0, REPORT_DIGIT = 1 }

## Public Member Functions

| CSHA1 ()
virtual | ~CSHA1 ()
void | Reset ()
void | Update (unsigned char *data, unsigned int len)
bool | HashFile (char *szFileName)
void | Final ()
void | ReportHash (char *szReport, unsigned char uReportType=REPORT_HEX)
void | GetHash (unsigned char *uDest)
unsigned char * | GetHash (void) const

## Public Attributes

unsigned long | m_state [5]
unsigned long | m_count [2]
unsigned char | m_buffer [64]
unsigned char | m_digest [20]

## Private Member Functions

void | Transform (unsigned long state[5], unsigned char buffer[64])

## Private Attributes

unsigned char | workspace [64]

## Classes

union | SHA1_WORKSPACE_BLOCK

## Detailed Description

Computes SHA-1 hashing class

## Member Enumeration Documentation

anonymous enum

Enumeration values:

  REPORT_HEX | Report in hexa
  REPORT_DIGIT | Report in digit

## Constructor & Destructor Documentation

CSHA1::CSHA1 | ( |  | ) |

| Default Constructor

CSHA1::~CSHA1 | ( |  | ) | `[virtual]`

| Destructor

## Member Function Documentation

void CSHA1::Final | ( |  | ) |

| Finalize hash and report

unsigned char * CSHA1::GetHash | ( | void |  | ) | const

| Get a pointer to the hash key data.

void CSHA1::GetHash | ( | unsigned char * | uDest | ) |

Retrieve the Hash in a previously allocated array

Parameters:

  | uDest | the destination array

bool CSHA1::HashFile | ( | char * | szFileName | ) |

Compute the SHA-1 hash key of a file

Parameters:

  | szFileName | The filename

Returns:
  true on success false otherwise

void CSHA1::ReportHash | ( | char * | szReport,
|  | unsigned char | uReportType = `REPORT_HEX`
| ) |

Retrieve the hash key

Parameters:

  | szReport | an array of byte containing the hash key
  | uReportType | the format of the report might be REPORT_HEX or REPORT_DIGIT

void CSHA1::Reset | ( |  | ) |

| Reset the internal state of the SHA-1 computation to compute a new SHA-1 hash key

void CSHA1::Transform | ( | unsigned long | state[5],
|  | unsigned char | buffer[64]
| ) | `[private]`

| Private SHA-1 transformation

void CSHA1::Update | ( | unsigned char * | data,
|  | unsigned int | len
| ) |

Update the hash value from a byte buffer

Parameters:

  | data | the byte buffer
  | len | the number of byte available in the byte buffer

## Member Data Documentation

unsigned char CSHA1::m_buffer[64]

unsigned long CSHA1::m_count[2]

unsigned char CSHA1::m_digest[20]

unsigned long CSHA1::m_state[5]

unsigned char CSHA1::workspace[64]`[private]`

| Moved here for thread and multiple instance safety

The documentation for this class was generated from the following files:

- Projects/raknet/include/raknet/SHA1.h
- Projects/raknet/Source/SHA1.cpp