sha.h

00001 /*
00002   Copyright (c) 2006-2008 by Jakob Schroeter <js@camaya.net>
00003   This file is part of the gloox library. http://camaya.net/gloox
00004 
00005   This software is distributed under a license. The full license
00006   agreement can be found in the file LICENSE in this distribution.
00007   This software may not be copied, modified, sold or distributed
00008   other than expressed in the named license agreement.
00009 
00010   This software is distributed without any warranty.
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__

Generated on Sun Apr 27 11:08:13 2008 for gloox by  doxygen 1.5.5