Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

HAVAL Class Reference

#include <haval.h>

Inheritance diagram for HAVAL:

IteratedHash< word32, LittleEndian, 128 > IteratedHashBase< word32, HashTransformation > HashTransformation Algorithm Clonable HAVAL3 HAVAL4 HAVAL5 List of all members.

Detailed Description

HAVAL

Warning:
HAVAL with 128-bit or 160-bit output is considered insecure, and should not be used unless you absolutely need it for compatibility.

Definition at line 11 of file haval.h.

Public Types

enum  { DIGESTSIZE = 32, HAVAL_VERSION = 1 }
typedef LittleEndian ByteOrderClass
typedef word32 HashWordType

Public Member Functions

 HAVAL (unsigned int digestSize=DIGESTSIZE, unsigned int passes=3)
 digestSize can be 16, 20, 24, 28, or 32 (Default=32)
pass can be 3, 4 or 5 (Default=3)
void TruncatedFinal (byte *hash, unsigned int size)
 truncated version of Final()
unsigned int DigestSize () const
 size of the hash returned by Final()
std::string AlgorithmName () const
 returns name of this algorithm, not universally implemented yet
ByteOrder GetByteOrder () const
 IteratedHashBase ()
unsigned int BlockSize () const
 block size of underlying compression function, or 0 if not block based
unsigned int OptimalBlockSize () const
 input to Update() should have length a multiple of this for optimal speed
unsigned int OptimalDataAlignment () const
 returns how input should be aligned for optimal performance
void Update (const byte *input, unsigned int length)
 process more input
byte * CreateUpdateSpace (unsigned int &size)
 request space to write input into
void Restart ()
 discard the current state, and restart with a new message
virtual void Final (byte *digest)
 compute hash for current message, then restart for a new message
virtual void CalculateDigest (byte *digest, const byte *input, unsigned int length)
 use this if your input is in one piece and you don't want to call Update() and Final() separately
virtual bool Verify (const byte *digest)
 verify that digest is a valid digest for the current message, then reinitialize the object
virtual bool VerifyDigest (const byte *digest, const byte *input, unsigned int length)
 use this if your input is in one piece and you don't want to call Update() and Verify() separately
virtual void CalculateTruncatedDigest (byte *digest, unsigned int digestSize, const byte *input, unsigned int length)
 truncated version of CalculateDigest()
virtual bool TruncatedVerify (const byte *digest, unsigned int digestLength)
 truncated version of Verify()
virtual bool VerifyTruncatedDigest (const byte *digest, unsigned int digestLength, const byte *input, unsigned int length)
 truncated version of VerifyDigest()
virtual ClonableClone () const
 this is not implemented by most classes yet

Static Public Member Functions

static const char * StaticAlgorithmName ()
static void CorrectEndianess (HashWordType *out, const HashWordType *in, unsigned int byteCount)

Static Public Attributes

static CompileAssert<((BLOCKSIZE
&(BLOCKSIZE-1))==0) 
cryptopp_assert___LINE__ )

Protected Member Functions

void Init ()
void Tailor (unsigned int FPTLEN)
void HashEndianCorrectedBlock (const word32 *in)
 IteratedHash ()
void SetBlockSize (unsigned int blockSize)
void SetStateSize (unsigned int stateSize)
word32 GetBitCountHi () const
word32 GetBitCountLo () const
void PadLastBlock (unsigned int lastBlockSize, byte padFirst=0x80)
virtual void HashEndianCorrectedBlock (const HashWordType *data)=0
virtual unsigned int HashMultipleBlocks (const word32 *input, unsigned int length)
void HashBlock (const HashWordType *input)
void ThrowIfInvalidTruncatedSize (unsigned int size) const

Protected Attributes

const unsigned int digestSize
const unsigned int pass
SecBlock< word32 > m_data
SecBlock< word32 > m_digest

Static Protected Attributes

static const unsigned int wi2 [32] = { 5,14,26,18,11,28, 7,16, 0,23,20,22, 1,10, 4, 8,30, 3,21, 9,17,24,29, 6,19,12,15,13, 2,25,31,27}
static const unsigned int wi3 [32] = {19, 9, 4,20,28,17, 8,22,29,14,25,12,24,30,16,26,31,15, 7, 3, 1, 0,18,27,13, 6,21,10,23,11, 5, 2}
static const unsigned int wi4 [32] = {24, 4, 0,14, 2, 7,28,23,26, 6,30,20,18,25,19, 3,22,11,31,21, 8,27,12, 9, 1,29, 5,15,17,10,16,13}
static const unsigned int wi5 [32] = {27, 3,21,26,17,11,20,29,19, 0,12, 7,13, 8,31,10, 5, 9,14,30,18, 6,28,24, 2,23,16,22, 4, 1,25,15}
static const word32 mc2 [32]
static const word32 mc3 [32]
static const word32 mc4 [32]
static const word32 mc5 [32]


Member Function Documentation

virtual void HashTransformation::Final byte *  digest  )  [inline, virtual, inherited]
 

compute hash for current message, then restart for a new message

Precondition:
size of digest == DigestSize().

Definition at line 532 of file cryptlib.h.

Referenced by PSSR_MEM_Base::ComputeMessageRepresentative(), PKCS1v15_SignatureMessageEncodingMethod::ComputeMessageRepresentative(), EMSA5Pad< T >::ComputeMessageRepresentative(), PKCS5_PBKDF2_HMAC< T >::DeriveKey(), DefaultEncryptor::FirstPut(), PSSR_MEM_Base::RecoverMessageFromRepresentative(), HMAC_Base::TruncatedFinal(), ZlibCompressor::WritePoststreamTail(), and Gzip::WritePoststreamTail().

virtual bool HashTransformation::Verify const byte *  digest  )  [inline, virtual, inherited]
 

verify that digest is a valid digest for the current message, then reinitialize the object

Default implementation is to call Final() and do a bitwise comparison between its output and digest.

Definition at line 558 of file cryptlib.h.

Referenced by HashVerificationFilter::LastPut(), Gunzip::ProcessPoststreamTail(), and PSSR_MEM_Base::RecoverMessageFromRepresentative().


Member Data Documentation

const word32 HAVAL::mc2 [static, protected]
 

Initial value:

 {
  0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C, 0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917
, 0x9216D5D9, 0x8979FB1B, 0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7, 0xB8E1AFED, 0x6A267E96
, 0xBA7C9045, 0xF12C7F99, 0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16, 0x636920D8, 0x71574E69
, 0xA458FEA3, 0xF4933D7E, 0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE, 0x7B54A41D, 0xC25A59B5}

Definition at line 27 of file haval.h.

const word32 HAVAL::mc3 [static, protected]
 

Initial value:

 {
0x9C30D539,0x2AF26013,0xC5D1B023,0x286085F0,0xCA417918,0xB8DB38EF,0x8E79DCB0,0x603A180E,
0x6C9E0E8B,0xB01E8A3E,0xD71577C1,0xBD314B27,0x78AF2FDA,0x55605C60,0xE65525F3,0xAA55AB94,
0x57489862,0x63E81440,0x55CA396A,0x2AAB10B6,0xB4CC5C34,0x1141E8CE,0xA15486AF,0x7C72E993,
0xB3EE1411,0x636FBC2A,0x2BA9C55D,0x741831F6,0xCE5C3E16,0x9B87931E,0xAFD6BA33,0x6C24CF5C}

Definition at line 27 of file haval.h.

const word32 HAVAL::mc4 [static, protected]
 

Initial value:

 {
0x7A325381,0x28958677,0x3B8F4898,0x6B4BB9AF,0xC4BFE81B,0x66282193,0x61D809CC,0xFB21A991,
0x487CAC60,0x5DEC8032,0xEF845D5D,0xE98575B1,0xDC262302,0xEB651B88,0x23893E81,0xD396ACC5,
0x0F6D6FF3,0x83F44239,0x2E0B4482,0xA4842004,0x69C8F04A,0x9E1F9B5E,0x21C66842,0xF6E96C9A,
0x670C9C61,0xABD388F0,0x6A51A0D2,0xD8542F68,0x960FA728,0xAB5133A3,0x6EEF0B6C,0x137A3BE4}

Definition at line 27 of file haval.h.

const word32 HAVAL::mc5 [static, protected]
 

Initial value:

 {
0xBA3BF050,0x7EFB2A98,0xA1F1651D,0x39AF0176,0x66CA593E,0x82430E88,0x8CEE8619,0x456F9FB4,
0x7D84A5C3,0x3B8B5EBE,0xE06F75D8,0x85C12073,0x401A449F,0x56C16AA6,0x4ED3AA62,0x363F7706,
0x1BFEDF72,0x429B023D,0x37D0D724,0xD00A1248,0xDB0FEAD3,0x49F1C09B,0x075372C9,0x80991B7B,
0x25D479D8,0xF6E8DEF7,0xE3FE501A,0xB6794C3B,0x976CE0BD,0x04C006BA,0xC1A94FB6,0x409F60C4}

Definition at line 27 of file haval.h.


The documentation for this class was generated from the following files:
Generated on Tue Sep 6 03:43:05 2005 for Crypto++ by  doxygen 1.4.4