Next Previous Table Of Contents

# The SHA Abstract Base Class

    #include <chnhash/sha.hxx>

## Overview

The SHA abstract base class is intended to provide a class containing the features common to the FIPS 180 and FIPS 180-1 specifications of the Secure Hash Algorith. As the SHA class is a subclass of the ChainHash class, the variables and methods presented there are not redescribed here. Click here to see the definitions of the terms used on this page.

## Protected Variables

### H

    u32 H[5];

This array contains the chain variables for the SHA. `H[0]=H0`, `H[1]=H1`, ..., `H[4]=H4`.

### buf

    u32 buf[16];

This arrary is used in processing the blocks of the bit string the SHA instance is being evaluated at.

## Protected Methods

### ProcessBuffer

    virtual void ProcessBuf()=0;

This method is used to update the chain variables of the SHA instance according to the contents of buf and the current values of the chain variables.

## Public Constants

H0, H1, H2, H3, H4

    const u32 H0=0x67452301;
    const u32 H1=0xefcdab89;
    const u32 H2=0x98badcfe;
    const u32 H3=0x10325476;
    const u32 H4=0xc3d2e1f0;

These are the initial values of the chain variables for both instances of the SHA.

## Public Methods

### Constructor

    SHA();

Used in creating a SHA instance. Initializes the chain variables to values specified in FIPS 180 and FIPS 180-1.

### Destructor

    virtual ~SHA();

Nothing special is done by this desctructor.

Next Previous Table Of Contents