Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patching Sigma Generator creation #516

Merged
merged 4 commits into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/secp256k1/include/GroupElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ class GroupElement final {

std::size_t hash() const;

void set_base_g();

friend class MultiExponent;
private:
// Returns the secp object inside it.
Expand Down
4 changes: 4 additions & 0 deletions src/secp256k1/src/cpp/GroupElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,4 +550,8 @@ const void* GroupElement::get_value() const {
return g_;
}

void GroupElement::set_base_g() {
secp256k1_gej_set_ge(reinterpret_cast<secp256k1_gej *>(g_), &secp256k1_ge_const_g);
}

} // namespace secp_primitives
16 changes: 14 additions & 2 deletions src/sigma/params.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "chainparams.h"
#include "params.h"

namespace sigma {
Expand All @@ -8,8 +9,19 @@ Params* Params::get_default() {
return instance;
else {
//fixing generator G;
GroupElement g("9216064434961179932092223867844635691966339998754536116709681652691785432045",
"33986433546870000256104618635743654523665060392313886665479090285075695067131");
GroupElement g;

if(::Params().GenConsensus().IsMain()) {
unsigned char buff[32] = {0};
GroupElement base;
base.set_base_g();
base.sha256(buff);
g.generate(buff);
}
else
g = GroupElement("9216064434961179932092223867844635691966339998754536116709681652691785432045",
"33986433546870000256104618635743654523665060392313886665479090285075695067131");

//fixing n and m; N = n^m = 16,384
int n = 4;
int m = 7;
Expand Down