00001 /* 00002 * lib/crypto/shashbase.h 00003 * 00004 * Include header for (mostly cryptographic) hash algorithm base class. 00005 * 00006 * Copyright (c) 2001--2004 by Wolfgang Wieser ] wwieser (a) gmx <*> de [ 00007 * 00008 * This file may be distributed and/or modified under the terms of the 00009 * GNU General Public License version 2 as published by the Free Software 00010 * Foundation. (See COPYING.GPL for details.) 00011 * 00012 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00013 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00014 * 00015 */ 00016 00017 #ifndef _LIB_CRYPTO_SecureHashBase_H_ 00018 #define _LIB_CRYPTO_SecureHashBase_H_ 1 00019 00026 #include <lib/sconfig.h> /* MUST be first */ 00027 00028 00051 class SecureHashBase 00052 { 00053 public: 00055 struct Parameters 00056 { 00057 size_t hash_size; 00058 size_t block_size; 00059 int hash_ID; 00060 const char *name; 00061 }; 00062 00063 public: 00066 static const Parameters par; 00067 00068 protected: 00069 uint64 length; 00070 00071 private: 00073 SecureHashBase(const SecureHashBase &); 00074 void operator=(const SecureHashBase &); 00075 public: 00077 SecureHashBase() : length(0) { } 00079 virtual ~SecureHashBase() { } 00080 00090 virtual const Parameters *GetPar() const 00091 { return(&SecureHashBase::par); } 00092 00097 virtual uint64 FedBytes() const; 00098 00103 virtual void reset(); 00104 00116 virtual void feed(const char *buf,size_t len); 00117 00124 virtual void final(); 00125 00135 virtual void GetHash(char *buf) const; 00136 }; 00137 00138 #endif /* _LIB_CRYPTO_SecureHashBase_H_ */