dedup/inc/hash.h

29 lines
547 B
C
Raw Permalink Normal View History

2022-10-21 19:39:55 +02:00
#pragma once
#include <string>
#include <ostream>
class Hash {
public:
Hash();
2022-10-22 00:43:34 +02:00
Hash(const Hash&);
Hash(Hash&&);
2022-10-21 19:39:55 +02:00
virtual ~Hash();
static bool create(Hash& h, const std::string& file);
static bool create(Hash& h, int fd);
operator bool() const;
operator std::string() const;
bool operator==(const Hash& rhs) const;
bool operator!=(const Hash& rhs) const;
private:
2022-10-22 00:43:34 +02:00
unsigned char* data = nullptr;
2022-10-21 19:39:55 +02:00
friend std::ostream& operator<<(std::ostream& str, const Hash& rhs);
};
std::ostream& operator<<(std::ostream& str, const Hash& rhs);