Botan  1.10.9
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  */
51 
52  /**
53  * The message buffer, exposed for use by subclasses (asm, SSE2)
54  */
56  };
57 
58 }
59 
60 #endif
std::string name() const
Definition: sha160.h:21
unsigned char byte
Definition: types.h:22
SecureVector< u32bit > W
Definition: sha160.h:55
HashFunction * clone() const
Definition: sha160.h:23
SecureVector< u32bit > digest
Definition: sha160.h:50
size_t output_length() const
Definition: sha160.h:22
SHA_160(size_t W_size)
Definition: sha160.h:38