From 21fe717ce2027187e553d1edec65ef68b5d3c702 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 15 Jun 2003 13:41:32 +0000 Subject: * Refactoring: hash class. --- src/hash.hh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/hash.hh (limited to 'src/hash.hh') diff --git a/src/hash.hh b/src/hash.hh new file mode 100644 index 000000000..162b2b1c8 --- /dev/null +++ b/src/hash.hh @@ -0,0 +1,34 @@ +#ifndef __HASH_H +#define __HASH_H + +#include + +#include "util.hh" + +using namespace std; + + +struct Hash +{ + static const unsigned int hashSize = 16; + unsigned char hash[hashSize]; + + Hash(); + bool operator == (Hash & h2); + bool operator != (Hash & h2); + operator string() const; +}; + + +class BadRefError : public Error +{ +public: + BadRefError(string _err) : Error(_err) { }; +}; + + +Hash parseHash(const string & s); +bool isHash(const string & s); +Hash hashFile(const string & fileName); + +#endif /* !__HASH_H */ -- cgit v1.2.3