1 // Crypto/Sha1Cls.h
2 
3 #ifndef __CRYPTO_SHA1_CLS_H
4 #define __CRYPTO_SHA1_CLS_H
5 
6 #include "../../../C/Sha1.h"
7 
8 namespace NCrypto {
9 namespace NSha1 {
10 
11 const unsigned kNumBlockWords = SHA1_NUM_BLOCK_WORDS;
12 const unsigned kNumDigestWords = SHA1_NUM_DIGEST_WORDS;
13 
14 const unsigned kBlockSize = SHA1_BLOCK_SIZE;
15 const unsigned kDigestSize = SHA1_DIGEST_SIZE;
16 
17 class CContext
18 {
19   CSha1 _s;
20 
21 public:
Init()22   void Init() throw() { Sha1_Init(&_s); }
Update(const Byte * data,size_t size)23   void Update(const Byte *data, size_t size) throw() { Sha1_Update(&_s, data, size); }
Final(Byte * digest)24   void Final(Byte *digest) throw() { Sha1_Final(&_s, digest); }
PrepareBlock(Byte * block,unsigned size)25   void PrepareBlock(Byte *block, unsigned size) const throw()
26   {
27     Sha1_PrepareBlock(&_s, block, size);
28   }
GetBlockDigest(const Byte * blockData,Byte * destDigest)29   void GetBlockDigest(const Byte *blockData, Byte *destDigest) const throw()
30   {
31     Sha1_GetBlockDigest(&_s, blockData, destDigest);
32   }
33 };
34 
35 }}
36 
37 #endif
38