CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
hash.h
Go to the documentation of this file.
1
6// //////////////////////////////////////////////////////////
7// hash.h
8// Copyright (c) 2014,2015 Stephan Brumme. All rights reserved.
9// see http://create.stephan-brumme.com/disclaimer.html
10//
11
12#pragma once
13
14#include <string>
15
16// Added namespace to avoid clash with OpenSSL
17namespace hash {
18
20class Hash
21{
22public:
24 virtual std::string operator()(const void* data, size_t numBytes) = 0;
26 virtual std::string operator()(const std::string& text) = 0;
27
29 virtual void add(const void* data, size_t numBytes) = 0;
30
32 virtual std::string getHash() = 0;
33
35 virtual void reset() = 0;
36};
37
38} // namespace hash
abstract base class
Definition hash.h:21
virtual std::string operator()(const std::string &text)=0
compute hash of a string, excluding final zero
virtual std::string operator()(const void *data, size_t numBytes)=0
compute hash of a memory block
virtual void add(const void *data, size_t numBytes)=0
add arbitrary number of bytes
virtual std::string getHash()=0
return latest hash as hex characters
virtual void reset()=0
restart
Usage: std::string msg = "The quick brown fox jumps over the lazy dog"; std::string key = "key"; std:...
Definition crc32.h:28