22 #ifndef TAO_CRYPT_SHA_HPP
23 #define TAO_CRYPT_SHA_HPP
28 #if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM)
38 enum { BLOCK_SIZE = 64, DIGEST_SIZE = 20, PAD_SIZE = 56,
39 TAO_BYTE_ORDER = BigEndianOrder};
42 ByteOrder getByteOrder()
const {
return ByteOrder(TAO_BYTE_ORDER); }
43 word32 getBlockSize()
const {
return BLOCK_SIZE; }
44 word32 getDigestSize()
const {
return DIGEST_SIZE; }
45 word32 getPadSize()
const {
return PAD_SIZE; }
48 void Update(
const byte* data, word32 len);
53 SHA& operator= (
const SHA&);
58 void AsmTransform(
const byte* data, word32 times);
62 inline void swap(
SHA& a,
SHA& b)
70 enum { BLOCK_SIZE = 64, DIGEST_SIZE = 32, PAD_SIZE = 56,
71 TAO_BYTE_ORDER = BigEndianOrder};
74 ByteOrder getByteOrder()
const {
return ByteOrder(TAO_BYTE_ORDER); }
75 word32 getBlockSize()
const {
return BLOCK_SIZE; }
76 word32 getDigestSize()
const {
return DIGEST_SIZE; }
77 word32 getPadSize()
const {
return PAD_SIZE; }
93 enum { BLOCK_SIZE = 64, DIGEST_SIZE = 28, PAD_SIZE = 56,
94 TAO_BYTE_ORDER = BigEndianOrder};
97 ByteOrder getByteOrder()
const {
return ByteOrder(TAO_BYTE_ORDER); }
98 word32 getBlockSize()
const {
return BLOCK_SIZE; }
99 word32 getDigestSize()
const {
return DIGEST_SIZE; }
100 word32 getPadSize()
const {
return PAD_SIZE; }
113 #ifdef WORD64_AVAILABLE
116 class SHA512 :
public HASH64withTransform {
118 enum { BLOCK_SIZE = 128, DIGEST_SIZE = 64, PAD_SIZE = 112,
119 TAO_BYTE_ORDER = BigEndianOrder};
120 SHA512() : HASH64withTransform(DIGEST_SIZE / sizeof(word64), BLOCK_SIZE)
122 ByteOrder getByteOrder()
const {
return ByteOrder(TAO_BYTE_ORDER); }
123 word32 getBlockSize()
const {
return BLOCK_SIZE; }
124 word32 getDigestSize()
const {
return DIGEST_SIZE; }
125 word32 getPadSize()
const {
return PAD_SIZE; }
129 SHA512(
const SHA512&);
130 SHA512& operator= (
const SHA512&);
139 class SHA384 :
public HASH64withTransform {
141 enum { BLOCK_SIZE = 128, DIGEST_SIZE = 48, PAD_SIZE = 112,
142 TAO_BYTE_ORDER = BigEndianOrder};
143 SHA384() : HASH64withTransform(SHA512::DIGEST_SIZE/ sizeof(word64),
146 ByteOrder getByteOrder()
const {
return ByteOrder(TAO_BYTE_ORDER); }
147 word32 getBlockSize()
const {
return BLOCK_SIZE; }
148 word32 getDigestSize()
const {
return DIGEST_SIZE; }
149 word32 getPadSize()
const {
return PAD_SIZE; }
153 SHA384(
const SHA384&);
154 SHA384& operator= (
const SHA384&);
161 enum { MAX_SHA2_DIGEST_SIZE = 64 };
165 enum { MAX_SHA2_DIGEST_SIZE = 32 };
167 #endif // WORD64_AVAILABLE
173 #endif // TAO_CRYPT_SHA_HPP