forked from zbackup/zbackup
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsha256.hh
More file actions
37 lines (27 loc) · 715 Bytes
/
sha256.hh
File metadata and controls
37 lines (27 loc) · 715 Bytes
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
// Copyright (c) 2012-2014 Konstantin Isakov <ikm@zbackup.org> and ZBackup contributors, see CONTRIBUTORS
// Part of ZBackup. Licensed under GNU GPLv2 or later + OpenSSL, see LICENSE
#ifndef SHA256_HH_INCLUDED
#define SHA256_HH_INCLUDED
#include <string>
#include <openssl/sha.h>
#include <stddef.h>
using std::string;
/// A simple wrapper over openssl
class Sha256
{
SHA256_CTX ctx;
public:
enum
{
// Number of bytes a digest has
Size = SHA256_DIGEST_LENGTH
};
Sha256();
/// Adds more data
void add( void const * data, size_t size );
/// Result should point at at least Size bytes
void finish( void * result );
/// Returns result as a string blob
string finish();
};
#endif