-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathchaum.h
More file actions
87 lines (78 loc) · 2.38 KB
/
Copy pathchaum.h
File metadata and controls
87 lines (78 loc) · 2.38 KB
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
#ifndef FIRO_LIBSPARK_CHAUM_H
#define FIRO_LIBSPARK_CHAUM_H
#include "chaum_proof.h"
#include "../bitcoin/uint256.h"
#include "../secp256k1/include/MultiExponent.h"
namespace spark {
struct ChaumV2Context {
uint64_t fee = 0;
uint64_t transparent_value = 0;
std::vector<std::vector<unsigned char>> serialized_outputs;
uint256 extension_commitment{};
std::vector<unsigned char> serialized_cover_set_references;
};
class Chaum {
public:
Chaum(const GroupElement& F, const GroupElement& G, const GroupElement& H, const GroupElement& U);
void prove_v1(
const Scalar& mu,
const std::vector<Scalar>& x,
const std::vector<Scalar>& y,
const std::vector<Scalar>& z,
const std::vector<GroupElement>& S,
const std::vector<GroupElement>& T,
ChaumProofV1& proof
);
// Original verification retained for pre-activation historical blocks.
bool verify_v1(
const Scalar& mu,
const std::vector<GroupElement>& S,
const std::vector<GroupElement>& T,
ChaumProofV1& proof
);
bool verify_single_input(
const Scalar& mu,
const std::vector<GroupElement>& S,
const std::vector<GroupElement>& T,
ChaumProofV1& proof
);
void prove_v2(
const Scalar& mu,
const ChaumV2Context& context,
const std::vector<Scalar>& x,
const std::vector<Scalar>& y,
const std::vector<Scalar>& z,
const std::vector<GroupElement>& S,
const std::vector<GroupElement>& T,
ChaumProofV2& proof
);
bool verify_v2(
const Scalar& mu,
const ChaumV2Context& context,
const std::vector<GroupElement>& S,
const std::vector<GroupElement>& T,
const ChaumProofV2& proof
);
private:
Scalar challenge_v1(
const Scalar& mu,
const std::vector<GroupElement>& S,
const std::vector<GroupElement>& T,
const GroupElement& A1,
const std::vector<GroupElement>& A2
);
Scalar challenge_v2(
const Scalar& mu,
const ChaumV2Context& context,
const std::vector<GroupElement>& S,
const std::vector<GroupElement>& T,
const std::vector<GroupElement>& A1,
const std::vector<GroupElement>& A2
);
const GroupElement& F;
const GroupElement& G;
const GroupElement& H;
const GroupElement& U;
};
}
#endif