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

Hadar/b const mult #723

Merged
merged 5 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
16 changes: 16 additions & 0 deletions icicle/include/icicle/curves/params/bls12_377.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ namespace bls12_377 {
static constexpr point_field_t weierstrass_b = {0x00000001, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000};
static constexpr point_field_t weierstrass_3b = {0x00000003, 0x00000000, 0x00000000, 0x00000000,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need that extra definition?
using constexpr in the code does not yield the same performance?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it probably will, i can try

0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000};
static constexpr bool is_b_u32 = true;
static constexpr bool is_b_neg = false;
}; // G1

struct G2 {
Expand All @@ -46,6 +51,17 @@ namespace bls12_377 {
static constexpr point_field_t weierstrass_b_g2_im = {0x9999999a, 0x1c9ed999, 0x1ccccccd, 0x0dd39e5c,
0x3c6bf800, 0x129207b6, 0xcd5fd889, 0xdc7b4f91,
0x7460c589, 0x43bd0373, 0xdb0fd6f3, 0x010222f6};
static constexpr point_field_t weierstrass_3b_g2_re = {0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000};
static constexpr point_field_t weierstrass_3b_g2_im = {0xcccccccd, 0xd0d3cccc, 0x26666666, 0x126f7dd0,
0xfb3aa000, 0x18c2b4f2, 0x672a760c, 0x7b4f14c2,
0xf0810762, 0x04fc0499, 0x796a73ef, 0x01582e9e};

static constexpr bool is_b_u32_g2_re = true;
static constexpr bool is_b_neg_g2_re = false;
static constexpr bool is_b_u32_g2_im = false;
static constexpr bool is_b_neg_g2_im = false;

static constexpr g2_point_field_t gen_x = {g2_gen_x_re, g2_gen_x_im};
static constexpr g2_point_field_t gen_y = {g2_gen_y_re, g2_gen_y_im};
Expand Down
16 changes: 16 additions & 0 deletions icicle/include/icicle/curves/params/bls12_381.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ namespace bls12_381 {
static constexpr point_field_t weierstrass_b = {0x00000004, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000};
static constexpr point_field_t weierstrass_3b = {0x0000000c, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000};
static constexpr bool is_b_u32 = true;
static constexpr bool is_b_neg = false;
};

struct G2 {
Expand All @@ -47,6 +52,17 @@ namespace bls12_381 {
static constexpr point_field_t weierstrass_b_g2_im = {0x00000004, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000};
static constexpr point_field_t weierstrass_3b_g2_re = {0x0000000c, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000};
static constexpr point_field_t weierstrass_3b_g2_im = {0x0000000c, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000};

static constexpr bool is_b_u32_g2_re = true;
static constexpr bool is_b_neg_g2_re = false;
static constexpr bool is_b_u32_g2_im = true;
static constexpr bool is_b_neg_g2_im = false;

static constexpr g2_point_field_t gen_x = {g2_gen_x_re, g2_gen_x_im};
static constexpr g2_point_field_t gen_y = {g2_gen_y_re, g2_gen_y_im};
Expand Down
13 changes: 13 additions & 0 deletions icicle/include/icicle/curves/params/bn254.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ namespace bn254 {
0x00000000, 0x00000000, 0x00000000, 0x00000000};
static constexpr point_field_t weierstrass_b = {0x00000003, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000};
static constexpr point_field_t weierstrass_3b = {0x00000009, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000};
static constexpr bool is_b_u32 = true;
static constexpr bool is_b_neg = false;
}; // G1

struct G2 {
Expand All @@ -39,6 +43,15 @@ namespace bn254 {
0x1be06ac3, 0x81be1899, 0xceb8aaae, 0x2b149d40};
static constexpr point_field_t weierstrass_b_g2_im = {0x85c315d2, 0xe4a2bd06, 0xe52d1852, 0xa74fa084,
0xeed8fdf4, 0xcd2cafad, 0x3af0fed4, 0x009713b0};
static constexpr point_field_t weierstrass_3b_g2_re = {0xbce9b021, 0x1ef69c66, 0x3cb039cf, 0xf21b7c8d,
0x509e8f8f, 0x1499be5e, 0xa9c6bfb8, 0x20753adc};
static constexpr point_field_t weierstrass_3b_g2_im = {0x91494176, 0xade83713, 0xaf8748f8, 0xf5eee18e,
0xcc8af9dd, 0x67860f09, 0xb0d2fc7e, 0x01c53b10};

static constexpr bool is_b_u32_g2_re = false;
static constexpr bool is_b_neg_g2_re = false;
static constexpr bool is_b_u32_g2_im = false;
static constexpr bool is_b_neg_g2_im = false;

static constexpr g2_point_field_t gen_x = {g2_gen_x_re, g2_gen_x_im};
static constexpr g2_point_field_t gen_y = {g2_gen_y_re, g2_gen_y_im};
Expand Down
25 changes: 22 additions & 3 deletions icicle/include/icicle/curves/params/bw6_761.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,22 @@ namespace bw6_761 {
0xb3053253, 0x9f9df141, 0x6fc2cdd4, 0xbe3fb90b, 0x717a4c55, 0xcc685d31,
0x71b5b806, 0xc5b8fa17, 0xaf7e0dba, 0x265909f1, 0xa2e573a3, 0x1a7348d2,
0x884c9ec6, 0x0f952589, 0x45cc2a42, 0xe6fd637b, 0x0a6fc574, 0x0058b84e};
// actual value:
// static constexpr point_field_t weierstrass_b = {
// 0x0000008a, 0xf49d0000, 0x70000082, 0xe6913e68, 0xeaf0a437, 0x160cf8ae, 0x5667a8f8, 0x98a116c2,
// 0x73ebff2e, 0x71dcd3dc, 0x12f9fd90, 0x8689c8ed, 0x25b42304, 0x03cebaff, 0xe584e919, 0x707ba638,
// 0x8087be41, 0x528275ef, 0x81d14688, 0xb926186a, 0x04faff3e, 0xd187c940, 0xfb83ce0a, 0x0122e824};
static constexpr point_field_t weierstrass_b = {
0x0000008a, 0xf49d0000, 0x70000082, 0xe6913e68, 0xeaf0a437, 0x160cf8ae, 0x5667a8f8, 0x98a116c2,
0x73ebff2e, 0x71dcd3dc, 0x12f9fd90, 0x8689c8ed, 0x25b42304, 0x03cebaff, 0xe584e919, 0x707ba638,
0x8087be41, 0x528275ef, 0x81d14688, 0xb926186a, 0x04faff3e, 0xd187c940, 0xfb83ce0a, 0x0122e824};
0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000};
static constexpr point_field_t weierstrass_3b = {
0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000};

static constexpr bool is_b_u32 = true;
static constexpr bool is_b_neg = true;
};

struct G2 {
Expand All @@ -44,5 +56,12 @@ namespace bw6_761 {
0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000};
static constexpr g2_point_field_t weierstrass_3b = {
0x0000000c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000};

static constexpr bool is_b_u32 = true;
static constexpr bool is_b_neg = false;
};
} // namespace bw6_761
11 changes: 9 additions & 2 deletions icicle/include/icicle/curves/params/grumpkin.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ namespace grumpkin {
static constexpr point_field_t gen_y = {0x823f272c, 0x833fc48d, 0xf1181294, 0x2d270d45,
0x6a45d63, 0xcf135e75, 0x00000002, 0x00000000};

static constexpr point_field_t weierstrass_b = {0xeffffff0, 0x43e1f593, 0x79b97091, 0x2833e848,
0x8181585d, 0xb85045b6, 0xe131a029, 0x30644e72};
// actual value:
// static constexpr point_field_t weierstrass_b = {0xeffffff0, 0x43e1f593, 0x79b97091, 0x2833e848,
// 0x8181585d, 0xb85045b6, 0xe131a029, 0x30644e72};
static constexpr point_field_t weierstrass_b = {0x00000011, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000};
static constexpr point_field_t weierstrass_3b = {0x00000033, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000};
static constexpr bool is_b_u32 = true;
static constexpr bool is_b_neg = true;
}; // G1
} // namespace grumpkin
Loading
Loading