23 #ifndef TAO_CRYPT_HASH_HPP
24 #define TAO_CRYPT_HASH_HPP
36 virtual void Update(
const byte*, word32) = 0;
37 virtual void Final(byte*) = 0;
39 virtual void Init() = 0;
41 virtual word32 getBlockSize()
const = 0;
42 virtual word32 getDigestSize()
const = 0;
51 virtual ByteOrder getByteOrder()
const = 0;
52 virtual word32 getPadSize()
const = 0;
54 virtual void Update(
const byte*, word32);
55 virtual void Final(byte*);
57 word32 GetBitCountLo()
const {
return loLen_ << 3; }
58 word32 GetBitCountHi()
const {
return (loLen_ >> (8*
sizeof(loLen_) - 3)) +
60 enum { MaxDigestSz = 8, MaxBufferSz = 64 };
62 typedef word32 HashLengthType;
64 HashLengthType loLen_;
65 HashLengthType hiLen_;
66 word32 digest_[MaxDigestSz];
67 word32 buffer_[MaxBufferSz /
sizeof(word32)];
69 virtual void Transform() = 0;
71 void AddLength(word32);
75 #ifdef WORD64_AVAILABLE
78 class HASH64withTransform :
public HASH {
80 HASH64withTransform(word32 digSz, word32 buffSz);
81 virtual ~HASH64withTransform() {}
82 virtual ByteOrder getByteOrder()
const = 0;
83 virtual word32 getPadSize()
const = 0;
85 virtual void Update(
const byte*, word32);
86 virtual void Final(byte*);
88 word32 GetBitCountLo()
const {
return loLen_ << 3; }
89 word32 GetBitCountHi()
const {
return (loLen_ >> (8*
sizeof(loLen_) - 3)) +
91 enum { MaxDigestSz = 8, MaxBufferSz = 128 };
93 typedef word32 HashLengthType;
95 HashLengthType loLen_;
96 HashLengthType hiLen_;
97 word64 digest_[MaxDigestSz];
98 word64 buffer_[MaxBufferSz /
sizeof(word64)];
100 virtual void Transform() = 0;
102 void AddLength(word32);
105 #endif // WORD64_AVAILABLE
110 #endif // TAO_CRYPT_HASH_HPP