gloox  1.0.28
sha.h
1 /*
2  Copyright (c) 2006-2023 by Jakob Schröter <js@camaya.net>
3  This file is part of the gloox library. http://camaya.net/gloox
4 
5  This software is distributed under a license. The full license
6  agreement can be found in the file LICENSE in this distribution.
7  This software may not be copied, modified, sold or distributed
8  other than expressed in the named license agreement.
9 
10  This software is distributed without any warranty.
11 */
12 
13 #ifndef SHA_H__
14 #define SHA_H__
15 
16 #include "macros.h"
17 
18 #include <string>
19 
20 namespace gloox
21 {
22 
29  class GLOOX_API SHA
30  {
31 
32  public:
36  SHA();
37 
41  virtual ~SHA();
42 
46  void reset();
47 
51  void finalize();
52 
58  const std::string hex();
59 
65  const std::string binary();
66 
72  void feed( const unsigned char* data, unsigned length );
73 
78  void feed( const std::string& data );
79 
80  private:
81  void process();
82  void pad();
83  inline unsigned shift( int bits, unsigned word );
84  void init();
85 
86  unsigned H[5];
87  unsigned Length_Low;
88  unsigned Length_High;
89  unsigned char Message_Block[64];
90  int Message_Block_Index;
91  bool m_finished;
92  bool m_corrupted;
93 
94  };
95 
96 }
97 
98 #endif // SHA_H__
An implementation of SHA1.
Definition: sha.h:30
The namespace for the gloox library.
Definition: adhoc.cpp:28