-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sha256.hpp.md
68 lines (40 loc) · 1.19 KB
/
sha256.hpp.md
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
```cpp
/*
<fpaste ../../src/copyright.md>
*/
#pragma once
#include <filesystem>
#include "lxr/key256.hpp"
#include "sizebounded/sizebounded.hpp"
````
namespace [lxr](namespace.list) {
# class Sha256
// implementations exist for [OpenSSL](sha256_openssl.cpp.md)
// and [Crypto++](sha256_cryptopp.cpp.md)
{
>public:
>static Key256 [hash](sha256_functions.cpp.md)(std::string const &);
>static Key256 [hash](sha256_functions.cpp.md)(const char[], int length);
>static Key256 [hash](sha256_functions.cpp.md)(std::filesystem::path const &);
>Sha256();
>~Sha256();
>static constexpr unsigned int datasz { 1024*64 };
>int [process](sha256_functions.cpp.md)(int inlen, sizebounded<unsigned char, Sha256::datasz> const & inbuf);
>Key256 [finish](sha256_functions.cpp.md)();
>private:
>struct pimpl;
>std::unique_ptr<pimpl> _pimpl;
>Sha256(Sha256 const &) = delete;
>Sha256 & operator=(Sha256 const &) = delete;
};
```cpp
} // namespace
```
# // C binding interface
```cpp
#include "lxr/lxr-cbindings.hpp"
```
extern `"C"` EXPORT
CKey256* [hash_Sha256](sha256_cbindings.cpp.md)(int len, const char *s);
extern `"C"` EXPORT
CKey256* [filehash_Sha256](sha256_cbindings.cpp.md)(const char * fp);