summaryrefslogtreecommitdiff
path: root/ThirdParty/hash-library/hash.h
blob: 6c6f2eaa957ec27152a60ce05236621b1b593c02 (plain)
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
// //////////////////////////////////////////////////////////
// hash.h
// Copyright (c) 2014,2015 Stephan Brumme. All rights reserved.
// see http://create.stephan-brumme.com/disclaimer.html
//

#pragma once

#include <string>

/// abstract base class
class Hash
{
public:
  /// compute hash of a memory block
  virtual std::string operator()(const void* data, size_t numBytes) = 0;
  /// compute hash of a string, excluding final zero
  virtual std::string operator()(const std::string& text) = 0;

  /// add arbitrary number of bytes
  virtual void add(const void* data, size_t numBytes) = 0;

  /// return latest hash as hex characters
  virtual std::string getHash() = 0;

  /// restart
  virtual void reset() = 0;
};