Botan 1.10.17

sha160.h
Go to the documentation of this file.
1 /*
2 * SHA-160
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_SHA_160_H__
9 #define BOTAN_SHA_160_H__
10
11 #include <botan/mdx_hash.h>
12
13 namespace Botan {
14
15 /**
16 * NIST's SHA-160
17 */
18 class BOTAN_DLL SHA_160 : public MDx_HashFunction
19 {
20 public:
21 std::string name() const { return "SHA-160"; }
22 size_t output_length() const { return 20; }
23 HashFunction* clone() const { return new SHA_160; }
24
25 void clear();
26
27 SHA_160() : MDx_HashFunction(64, true, true), digest(5), W(80)
28 {
29 clear();
30 }
31 protected:
32 /**
33 * Set a custom size for the W array. Normally 80, but some
34 * subclasses need slightly more for best performance/internal
35 * constraints
36 * @param W_size how big to make W
37 */
38 SHA_160(size_t W_size) :
39 MDx_HashFunction(64, true, true), digest(5), W(W_size)
40 {
41 clear();
42 }
43
44 void compress_n(const byte[], size_t blocks);
45 void copy_out(byte[]);
46
47 /**
48 * The digest value, exposed for use by subclasses (asm, SSE2)
49 */
50 SecureVector<u32bit> digest;
51
52 /**
53 * The message buffer, exposed for use by subclasses (asm, SSE2)
54 */
55 SecureVector<u32bit> W;
56 };
57
58 }
59
60 #endif
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::SHA_160::W
SecureVector< u32bit > W
Definition: sha160.h:55
Botan::SHA_160::output_length
size_t output_length() const
Definition: sha160.h:22
Botan::SHA_160
Definition: sha160.h:18
Botan::MDx_HashFunction
Definition: mdx_hash.h:18
Botan::SHA_160::digest
SecureVector< u32bit > digest
Definition: sha160.h:50
Botan::SHA_160::name
std::string name() const
Definition: sha160.h:21
Botan
Definition: algo_base.h:14
Botan::SHA_160::SHA_160
SHA_160()
Definition: sha160.h:27
Botan::HashFunction
Definition: hash.h:20
Botan::SecureVector< u32bit >
Botan::SHA_160::clone
HashFunction * clone() const
Definition: sha160.h:23
Botan::SHA_160::SHA_160
SHA_160(size_t W_size)
Definition: sha160.h:38