-
Notifications
You must be signed in to change notification settings - Fork 598
/
Copy pathSHA1.h
47 lines (37 loc) · 983 Bytes
/
SHA1.h
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
35
36
37
38
39
40
41
42
43
44
45
46
47
// 100% Public Domain.
//
// Original C Code
// -- Steve Reid <[email protected]>
// Small changes to fit into bglibs
// -- Bruce Guenter <[email protected]>
// Translation to simpler C++ Code
// -- Volker Grabsch <[email protected]>
// Safety fixes
// -- Eugene Hopkinson <slowriot at voxelstorm dot com>
// Adapt for project
// Dmitriy Khaustov <[email protected]>
//
// File created on: 2017.02.25
// SHA1.h
#pragma once
#include <cstdint>
#include <iostream>
#include <string>
namespace toolkit {
class SHA1 final
{
public:
SHA1();
void update(const std::string &s);
void update(std::istream &is);
std::string final();
std::string final_bin();
static std::string from_file(const std::string &filename);
static std::string encode(const std::string &s);
static std::string encode_bin(const std::string &s);
private:
uint32_t digest[5];
std::string buffer;
uint64_t transforms;
};
}//namespace toolkit