sha1transform.cpp File Reference


Detailed Description

This file implements the Secure Hashing Algorithm 1 as defined in FIPS PUB 180-1 published April 17, 1995.

The SHA-1, produces a 160-bit message digest for a given data stream. It should take about 2**n steps to find a message with the same digest as a given message and 2**(n/2) to find any two messages with the same digest, when n is the digest size in bits. Therefore, this algorithm can serve as a means of providing a "fingerprint" for a message.

Portability Issues: SHA-1 is defined in terms of 32-bit "words". This code uses <stdint.h> (included via "sha1.h" to define 32 and 8 bit unsigned integer types. If your C compiler does not support 32 bit unsigned integers, this code is not appropriate.

Caveats: SHA-1 is designed to work with messages less than 2^64 bits long. Although SHA-1 allows a message digest to be generated for messages of any number of bits less than 2^64, this implementation only works with messages with a length that is a multiple of the size of an 8-bit character.

Definition in file sha1transform.cpp.

#include <hn/hnprec.h>
#include <hn/sha1transform.h>

Include dependency graph for sha1transform.cpp:

Go to the source code of this file.


Defines

#define SHA1CircularShift(bits, word)   (((word) << (bits)) | ((word) >> (32-(bits))))

Define Documentation

#define SHA1CircularShift bits,
word   )     (((word) << (bits)) | ((word) >> (32-(bits))))
 

Definition at line 37 of file sha1transform.cpp.

Referenced by Sha1Transform::SHA1ProcessMessageBlock().