sha.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef SHA_H__
00014 #define SHA_H__
00015
00016 #include "macros.h"
00017
00018 #include <string>
00019
00020 namespace gloox
00021 {
00022
00029 class GLOOX_API SHA
00030 {
00031
00032 public:
00036 SHA();
00037
00041 virtual ~SHA();
00042
00046 void reset();
00047
00051 void finalize();
00052
00058 const std::string hex();
00059
00065 void feed( const unsigned char *data, unsigned length );
00066
00071 void feed( const std::string& data );
00072
00073 private:
00074 void process();
00075 void pad();
00076 inline unsigned shift( int bits, unsigned word );
00077 void init();
00078
00079 unsigned H[5];
00080 unsigned Length_Low;
00081 unsigned Length_High;
00082 unsigned char Message_Block[64];
00083 int Message_Block_Index;
00084 bool m_finished;
00085 bool m_corrupted;
00086
00087 };
00088
00089 }
00090
00091 #endif // SHA_H__