Skip to content

Commit

Permalink
Sigma verifier batching
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronFeickert committed Jun 2, 2021
1 parent 677b54c commit fcb8db9
Show file tree
Hide file tree
Showing 5 changed files with 266 additions and 246 deletions.
2 changes: 1 addition & 1 deletion src/sigma/sigma_primitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SigmaPrimitives {

static void convert_to_sigma(uint64_t num, uint64_t n, uint64_t m, std::vector<Exponent>& out);

static std::vector<uint64_t> convert_to_nal(uint64_t num, uint64_t n, uint64_t m);
static std::vector<std::size_t> convert_to_nal(std::size_t num, std::size_t n, std::size_t m);

static void generate_challenge(const std::vector<GroupElement>& group_elements,
Exponent& result_out);
Expand Down
17 changes: 7 additions & 10 deletions src/sigma/sigma_primitives.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,16 @@ void SigmaPrimitives<Exponent, GroupElement>::convert_to_sigma(
}

template<class Exponent, class GroupElement>
std::vector<uint64_t> SigmaPrimitives<Exponent, GroupElement>::convert_to_nal(
uint64_t num,
uint64_t n,
uint64_t m) {
std::vector<uint64_t> result;
uint64_t rem;
uint64_t j = 0;
std::vector<std::size_t> SigmaPrimitives<Exponent, GroupElement>::convert_to_nal(
std::size_t num,
std::size_t n,
std::size_t m) {
std::vector<std::size_t> result;
result.reserve(m);
while (num != 0)
{
rem = num % n;
result.emplace_back(num % n);
num /= n;
result.push_back(rem);
j++;
}
result.resize(m);
return result;
Expand Down
11 changes: 8 additions & 3 deletions src/sigma/sigmaplus_verifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ class SigmaPlusVerifier{
public:
SigmaPlusVerifier(const GroupElement& g,
const std::vector<GroupElement>& h_gens,
int n, int m_);
std::size_t n, std::size_t m_);

bool verify(const std::vector<GroupElement>& commits,
const SigmaPlusProof<Exponent, GroupElement>& proof,
bool fPadding) const;

bool verify(const std::vector<GroupElement>& commits,
const SigmaPlusProof<Exponent, GroupElement>& proof,
bool fPadding,
std::size_t setSize) const;

bool batch_verify(const std::vector<GroupElement>& commits,
const std::vector<Exponent>& serials,
const vector<bool>& fPadding,
Expand All @@ -43,8 +48,8 @@ class SigmaPlusVerifier{
private:
GroupElement g_;
std::vector<GroupElement> h_;
int n;
int m;
std::size_t n;
std::size_t m;
};

} // namespace sigma
Expand Down
Loading

0 comments on commit fcb8db9

Please sign in to comment.