00001 /* 00002 * lib/crypto/sha0hash.h 00003 * 00004 * Header file containing class SHA0Hash, a class for 00005 * computing the SHA message digest / hash algorithm as originally 00006 * specified by NIST/NSA. 00007 * 00008 * Copyright (c) 2000--2004 by Wolfgang Wieser ] wwieser (a) gmx <*> de [ 00009 * 00010 * This file may be distributed and/or modified under the terms of the 00011 * GNU General Public License version 2 as published by the Free Software 00012 * Foundation. (See COPYING.GPL for details.) 00013 * 00014 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00015 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00016 * 00017 */ 00018 00019 #ifndef _LIB_CRYPTO_SHA0Hash_H_ 00020 #define _LIB_CRYPTO_SHA0Hash_H_ 1 00021 00031 #include <lib/crypto/shashbase.h> 00032 00046 class SHA0Hash : public SecureHashBase 00047 { 00048 public: 00050 static const Parameters par; 00051 00052 private: 00053 uint32 state[5]; 00054 //uint64 length; <- in base class // length of hashed data in BYTES. 00055 00056 unsigned char tmpbuf[64]; 00057 int tmp_size; 00058 00060 void AtomicHash(const unsigned char *msg,uint32 *w); 00061 00063 SHA0Hash(const SHA0Hash &); 00064 void operator=(const SHA0Hash &); 00065 public: 00067 SHA0Hash() : SecureHashBase() 00068 { reset(); } 00070 ~SHA0Hash() 00071 { reset(); } 00072 00074 const Parameters *GetPar() const 00075 { return(&SHA0Hash::par); } 00076 00078 uint64 FedBytes() const 00079 { return(length); } 00080 00082 void reset(); 00083 00085 void feed(const char *buf,size_t len); 00086 00088 void final(); 00089 00091 void GetHash(char *buf) const; 00092 }; 00093 00094 #endif /* _LIB_CRYPTO_SHA0Hash_H_ */