diff options
Diffstat (limited to 'CPP/7zip/Crypto/Sha1Cls.h')
-rw-r--r-- | CPP/7zip/Crypto/Sha1Cls.h | 37 |
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 | |||
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: | ||
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 | ||