aboutsummaryrefslogtreecommitdiff
path: root/CPP/7zip/Crypto/Sha1Cls.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CPP/7zip/Crypto/Sha1Cls.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/CPP/7zip/Crypto/Sha1Cls.h b/CPP/7zip/Crypto/Sha1Cls.h
new file mode 100644
index 0000000..3461678
--- /dev/null
+++ b/CPP/7zip/Crypto/Sha1Cls.h
@@ -0,0 +1,37 @@
1// Crypto/Sha1Cls.h
2
3#ifndef __CRYPTO_SHA1_CLS_H
4#define __CRYPTO_SHA1_CLS_H
5
6#include "../../../C/Sha1.h"
7
8namespace NCrypto {
9namespace NSha1 {
10
11const unsigned kNumBlockWords = SHA1_NUM_BLOCK_WORDS;
12const unsigned kNumDigestWords = SHA1_NUM_DIGEST_WORDS;
13
14const unsigned kBlockSize = SHA1_BLOCK_SIZE;
15const unsigned kDigestSize = SHA1_DIGEST_SIZE;
16
17class CContext
18{
19 CSha1 _s;
20
21public:
22 void Init() throw() { Sha1_Init(&_s); }
23 void Update(const Byte *data, size_t size) throw() { Sha1_Update(&_s, data, size); }
24 void Final(Byte *digest) throw() { Sha1_Final(&_s, digest); }
25 void PrepareBlock(Byte *block, unsigned size) const throw()
26 {
27 Sha1_PrepareBlock(&_s, block, size);
28 }
29 void GetBlockDigest(const Byte *blockData, Byte *destDigest) const throw()
30 {
31 Sha1_GetBlockDigest(&_s, blockData, destDigest);
32 }
33};
34
35}}
36
37#endif