about summary refs log tree commit diff
path: root/src/hash.hh
blob: 162b2b1c8fb605ec726d63aeee986b58c93ab01d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef __HASH_H
#define __HASH_H

#include <string>

#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 */