Skip to content

Commit

Permalink
Add hybrid Torus alg. for compressed dlog tables. Replace memcmp call…
Browse files Browse the repository at this point in the history
…s. Remove unused functions.
  • Loading branch information
geovandro committed Jan 31, 2021
1 parent 566630e commit e990bc6
Show file tree
Hide file tree
Showing 18 changed files with 457 additions and 279 deletions.
2 changes: 1 addition & 1 deletion src/P434/P434_compressed.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const unsigned int strat_Bob[MAX_Bob-1] = {
// Fixed traversal strategies for Pohlig-Hellman discrete logs
const unsigned int ph2_path[PLEN_2] = {
#ifdef COMPRESSED_TABLES
#ifdef ELL2_FULL_SIGNED
#ifdef ELL2_TORUS
#if (W_2 == 4)
0, 0, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9, 9, 10, 11, 12, 13, 13, 13, 14, 14, 15, 16, 17, 18, 19, 19, 19, 19, 20, 21, 22, 22, 23, 24, 25, 26, 27, 27, 28, 28, 28, 28, 28, 29, 30, 31, 32, 33, 34, 34, 35
#endif
Expand Down
38 changes: 27 additions & 11 deletions src/P434/P434_compressed_dlog_tables.c

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions src/P434/P434_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,17 @@
#define DLEN_3 ((OBOB_EXPON+W_3-1)/W_3) // ceil(eB/W_3)
// Use compressed tables: FULL_SIGNED
#define COMPRESSED_TABLES
#define ELL2_FULL_SIGNED // Uses signed digits to reduce table size by half
#define ELL2_TORUS
#define ELL3_FULL_SIGNED // Uses signed digits to reduce table size by half
// Length of the optimal strategy path for Pohlig-Hellman
#ifdef COMPRESSED_TABLES
#ifdef ELL2_FULL_SIGNED
#if W_2 == 4
#define PLEN_2 55
#endif
#ifdef COMPRESSED_TABLES
#if W_2 == 4
#define PLEN_2 55
#endif
#ifdef ELL2_TORUS
#define W_2_1 3
#endif
#ifdef ELL3_FULL_SIGNED
#if W_3 == 3
#define PLEN_3 47
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/P503/P503_compressed.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const unsigned int strat_Bob[MAX_Bob - 1] = {
// Fixed traversal strategies for Pohlig-Hellman discrete logs
const unsigned int ph2_path[PLEN_2] = {
#ifdef COMPRESSED_TABLES
#ifdef ELL2_FULL_SIGNED
#ifdef ELL2_TORUS
#if W_2 == 5
0, 0, 1, 2, 3, 4, 4, 5, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12, 13, 13, 14, 14, 15, 16, 17, 18, 18, 18, 19, 20, 20, 21, 22, 23, 24, 25, 25, 25, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 34, 35, 35
#endif
Expand Down
37 changes: 28 additions & 9 deletions src/P503/P503_compressed_dlog_tables.c

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions src/P503/P503_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,16 @@
#define DLEN_3 ((OBOB_EXPON + W_3 - 1) / W_3) // ceil(eB/W_3)
// Use compressed tables: FULL_SIGNED
#define COMPRESSED_TABLES
#define ELL2_FULL_SIGNED // Uses signed digits to reduce table size by half
#define ELL2_TORUS
#define ELL3_FULL_SIGNED // Uses signed digits to reduce table size by half
// Length of the optimal strategy path for Pohlig-Hellman
#ifdef COMPRESSED_TABLES
#ifdef ELL2_FULL_SIGNED
#if W_2 == 5
#define PLEN_2 51
#endif
#if W_2 == 5
#define PLEN_2 51
#endif
#ifdef ELL2_TORUS
#define W_2_1 4
#endif
#ifdef ELL3_FULL_SIGNED
#if W_3 == 3
#define PLEN_3 54
Expand Down
2 changes: 1 addition & 1 deletion src/P610/P610_compressed.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const unsigned int strat_Bob[MAX_Bob-1] = { 86, 48, 27, 15, 8, 4, 2, 1, 1, 2, 1,
// Fixed traversal strategies for Pohlig-Hellman discrete logs
const unsigned int ph2_path[PLEN_2] = {
#ifdef COMPRESSED_TABLES
#ifdef ELL2_FULL_SIGNED
#ifdef ELL2_TORUS
#if (W_2 == 5)
0, 0, 1, 2, 3, 4, 4, 5, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12, 13, 13, 14, 14, 15, 16, 17, 18, 18, 18, 19, 20, 20, 21, 22, 23, 24, 25, 25, 25, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 34, 35, 35, 35, 35, 35, 36, 37, 38, 39, 40, 41, 41, 42
#endif
Expand Down
41 changes: 30 additions & 11 deletions src/P610/P610_compressed_dlog_tables.c

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions src/P610/P610_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,17 @@
#define DLEN_3 ((OBOB_EXPON+W_3-1)/W_3) // ceil(eB/W_3)
// Use compressed tables: FULL_SIGNED
#define COMPRESSED_TABLES
#define ELL2_FULL_SIGNED // Uses signed digits to reduce table size by half
#define ELL2_TORUS
#define ELL3_FULL_SIGNED // Uses signed digits to reduce table size by half
// Length of the optimal strategy path for Pohlig-Hellman
#ifdef COMPRESSED_TABLES
#ifdef ELL2_FULL_SIGNED
#if W_2 == 5
#define PLEN_2 62
#endif
#if W_2 == 5
#define PLEN_2 62
#endif
#ifdef ELL2_TORUS
#define W_2_1 4
#endif

#ifdef ELL3_FULL_SIGNED
#if W_3 == 3
#define PLEN_3 65
Expand Down
2 changes: 1 addition & 1 deletion src/P751/P751_compressed.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ const unsigned int strat_Bob[MAX_Bob-1] = {
// Fixed traversal strategies for Pohlig-Hellman discrete logs
const unsigned int ph2_path[PLEN_2] = {
#ifdef COMPRESSED_TABLES
#ifdef ELL2_FULL_SIGNED
#ifdef ELL2_TORUS
#if W_2 == 4
0, 0, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9, 9, 10, 11, 12, 13, 13, 13, 14, 14, 15, 16, 17, 18, 19, 19, 19, 19, 20, 21, 22, 22, 23, 24, 25, 26, 27, 27, 28, 28, 28, 28, 28, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37, 38, 39, 40, 40, 40, 40, 41, 42, 42, 42, 42, 42, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 52, 53, 54, 55, 56, 57, 58, 59, 59, 59, 59, 59, 59, 59
#endif
Expand Down
36 changes: 27 additions & 9 deletions src/P751/P751_compressed_dlog_tables.c

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions src/P751/P751_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
#define TABLE_V3_LEN 20
// Parameters for discrete log computations
// Binary Pohlig-Hellman reduced to smaller logs of order ell^W
#define W_2 4
#define W_2 4
#define W_3 3
// ell^w
#define ELL2_W (1 << W_2)
Expand All @@ -76,15 +76,17 @@
#define DLEN_3 ((OBOB_EXPON + W_3 - 1) / W_3) // ceil(eB/W_3)
// Use compressed tables: FULL_SIGNED
#define COMPRESSED_TABLES
#define ELL2_FULL_SIGNED // Uses signed digits to reduce table size by half
#define ELL2_TORUS
#define ELL3_FULL_SIGNED // Uses signed digits to reduce table size by half
// Length of the optimal strategy path for Pohlig-Hellman
#ifdef COMPRESSED_TABLES
#ifdef ELL2_FULL_SIGNED
#if W_2 == 4
#define PLEN_2 94
#endif
#if W_2 == 4
#define PLEN_2 94
#endif
#ifdef ELL2_TORUS
#define W_2_1 3
#endif

#ifdef ELL3_FULL_SIGNED
#if W_3 == 3
#define PLEN_3 81
Expand Down
Loading

0 comments on commit e990bc6

Please sign in to comment.