-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
key256.hpp.md
114 lines (69 loc) · 2.27 KB
/
key256.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
```cpp
/*
<fpaste ../../src/copyright.md>
*/
#pragma once
#include "lxr/key.hpp"
#include <memory>
````
namespace [lxr](namespace.list) {
/*
```fsharp
module Key256 =
type t
val length : int
(** length of the key in bytes *)
val create : unit -> t
(** create random key *)
val bytes : t -> byte array
(** key as bytes *)
val toHex : t -> string
(** hex representation of key *)
val fromHex : string -> t
(** make key from hex representation *)
```
*/
# class Key256 : public [Key](key.hpp.md)
{
>public:
>[Key256](key256_ctor.cpp.md)(bool noinit = false);
>virtual [~Key256](key256_ctor.cpp.md)();
>[Key256](key256_ctor.cpp.md)(Key256 const &);
>Key256 & [operator=](key256_ctor.cpp.md)(Key256 const &);
>static Key256 [key256FromHex](key256_functions.cpp.md)(std::string const &);
>virtual unsigned char const* [bytes](key256_functions.cpp.md)() const override;
>virtual int [length](key256_functions.cpp.md)() const override { return 256; };
>virtual bool [operator==](key256_functions.cpp.md)(Key256 const &) const final;
>virtual bool [operator!=](key256_functions.cpp.md)(Key256 const &) const final;
>virtual void [fromHex](key256_functions.cpp.md)(std::string const &) override;
>virtual void [fromBytes](key256_functions.cpp.md)(unsigned char const*) override;
>protected:
>virtual void map(std::function<void(const int, const unsigned char)>) const override;
>void zip(Key256 const &, std::function<void(const unsigned char, const unsigned char)>) const;
>virtual void transform(std::function<unsigned char(const int, const unsigned char)>) override;
>private:
>struct pimpl;
>std::unique_ptr<pimpl> _pimpl;
};
```cpp
} // namespace
```
# // C binding interface
```cpp
#include "lxr/lxr-cbindings.hpp"
```
struct CKey256 {
void * ptr;
};
extern `"C"` EXPORT
CKey256* [mk_Key256](key256_cbindings.cpp.md)();
extern `"C"` EXPORT
void [release_Key256](key256_cbindings.cpp.md)(CKey256*);
extern `"C"` EXPORT
int [len_Key256](key256_cbindings.cpp.md)(CKey256*);
extern `"C"` EXPORT
char* [bytes_Key256](key256_cbindings.cpp.md)(CKey256*);
extern `"C"` EXPORT
char* [tohex_Key256](key256_cbindings.cpp.md)(CKey256*);
extern `"C"` EXPORT
CKey256* [fromhex_Key256](key256_cbindings.cpp.md)(const char*);