ZKP Series #5 [ Discrete Logarithm ]
Tags: zeroknowledge, zkp, blockchain, web3
Published: 2024-03-14 02:25:33

We are going think of Discrete LogarImagine a world of secure communication, where confidential messages are scrambled and only authorized individuals can access them. This is the realm of cryptography, and a crucial concept within it is the Discrete Logarithm Problem (DLP).

Let's delve into the world of DLP through the lens of data and graphs, without getting sidetracked by war games.

Setting the Stage:

Prime Modulus: A large prime number acts as a foundation for the encryption process. Think of it as a giant vault door with a complex lock (e.g., a prime number like 59).
Generator: A publicly known number that serves as a key ingredient in the encryption recipe (e.g., a number like 2).
The Data: A Glimpse into the Encryption Process

The provided table offers a snippet of the relationship between exponents and their modular results:

| Mod 59 | \(2^x \mod 59\) | \(2^x\) |\(2^x \mod 59\)|
|--------|-----------------|---------|---------------|
|   0    |        1        |    1    |        1      |
|   1    |        2        |    2    |        2      |
|   2    |        4        |    4    |        4      |
|   3    |        8        |    8    |        8      |
|   4    |       16        |   16    |       16      |
|   5    |       32        |   32    |       32      |
|   6    |        5        |   64    |        5      |
|   7    |       10        |  128    |       10      |
|   8    |       20        |  256    |       20      |
|   9    |       40        |  512    |       40      |
|   10   |       21        |  1024   |       21      |
|   11   |       42        |  2048   |       42      |
|   12   |       23        |  4096   |       23      |
|   13   |       46        |  8192   |       46      |
|   14   |       31        |  16384  |       31      |
|   15   |        3        |  32768  |        3      |
|   16   |        6        |  65536  |        6      |
|   17   |       12        |  131072 |       12      |
|   18   |       24        |  262144 |       24      |
|   19   |       48        |  524288 |       48      |
|   20   |       37        | 1048576 |       37      |
|   21   |       19        | 2097152 |       19      |
|   22   |       38        | 4194304 |       38      |
|   23   |       41        | 8388608 |       41      |
|   24   |       35        |16777216 |       35      |
|   25   |       17        |33554432 |       17      |
|   26   |       34        |67108864 |       34      |
|   27   |       7         |134217728|       7       |
|   28   |       14        |268435456|       14      |
|   29   |       28        |536870912|       28      |
|   30   |       56        |1073741824|      56      |
|   31   |       55        |2147483648|      55      |
|   32   |       53        |4294967296|      53      |
|   33   |       49        |8589934592|      49      |
|   34   |       41        |17179869184|     41      |
|   35   |       35        |34359738368|     35      |
|   36   |       17        |68719476736|     17      |
|   37   |       34        |137438953472|    34      |
|   38   |       7         |274877906944|    7       |
|   39   |       14        |549755813888|    14      |
|   40   |       28        |1099511627776|   28      |
|   41   |       56        |2199023255552|   56      |
|   42   |       55        |4398046511104|   55      |
|   43   |       53        |8796093022208|   53      |
|   44   |       49        |17592186044416|  49      |
|   45   |       41        |35184372088832|  41      |
|   46   |       35        |70368744177664|  35      |
|   47   |       17        |140737488355328| 17      |
|   48   |       34        |281474976710656| 34      |
|   49   |       7         |562949953421312| 7       |
|   50   |       14        |1125899906842624|14      |
|   51   |       28        |2251799813685248|28      |
|   52   |       56        |4503599627370496|56      |
|   53   |       55        |9007199254740992|55      |
|   54   |       53        |18014398509481984|53     |
|   55   |       49        |36028797018963968|49     |
|   56   |       41        |72057594037927936|41     |
|   57   |       35        |144115188075855872|35    |
|   58   |       17        | 288230376151711744|  17 | 
Here's what the data signifies:

Mod 59: This column represents the remainder obtained after dividing the result of raising 2 to the power of x by 59.
(2^x mod 59): This column shows the outcome of calculating 2 raised to the power of x and then taking the remainder when divided by 59.
Visualizing the Challenge: The Power of Graphs


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a7nbo6e65zkqhqg4bek7.png)

VS


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9zsvjaoiz2iclti6x6ks.png)

Imagine a graph where the x-axis represents the exponent (x) and the y-axis represents the value of 2^x \mod 59. While the specific graph you mentioned isn't directly included, here's a general understanding:

Cyclical Nature: As you move along the x-axis (increasing the exponent), the corresponding y-values exhibit a repeating pattern. This recurrence arises due to the modular operation (division by the prime modulus).
Challenges for Codebreakers: Certain exponent values lead to the same remainder after division by the prime modulus. This cyclical behavior makes it incredibly difficult to determine the exact exponent used in the encryption process solely based on the encrypted message.
The Intricacy of DLP:

The DLP hinges on the following aspects:

Vast Number of Possibilities: With a large prime modulus like 59, there exist numerous possible exponents that could have resulted in the same encrypted message. Imagine searching for a specific grain of sand on a massive beach – the sheer number of options makes brute-force guessing nearly impossible.
One-Way Trapdoor: Raising a base (like 2) to different powers modulo a prime modulus is relatively simple. However, reversing this process to find the specific exponent used (akin to finding the grain of sand) is computationally infeasible due to the vast number of possibilities and the cyclical nature.
In essence, the DLP acts like a one-way door:

Information can easily flow in one direction (encryption).
Retrieving the original information from the encrypted message (decryption) without the secret key (the exponent) is exceptionally challenging.
Real-World Applications:

The DLP underpins various cryptographic systems:

Secure Communication: Protects online transactions, communication channels, and digital signatures.
Password Management: Enables secure storage and verification of passwords on various platforms.
Blockchain Technology: Plays a vital role in securing transactions within blockchain networks.
Conclusion:

The data and graphs offer a simplified glimpse into the fascinating world of the DLP. In real-world cryptography, much larger prime numbers and more intricate mathematical operations are employed to ensure the near impossibility of cracking the code. This makes the DLP a cornerstone of secure communication in our digital age.

Disclaimer: This explanation focuses on a simplified example. Real-world cryptography involves complex mathematical concepts and sophisticated algorithms.