Researcher, Enthusiast, Blockchain and Crypto Lover, Cryptography Lover, Ethereum is the King.

Arweave: The Permanent Data Storage
Permanent Cloud StorageIn today's digital age, cloud storage has become an essential aspect of our daily lives. With the increasing amount of data that we generate and need to store, the traditional means of data storage, such as physical hard drives or flash drives, are becoming less practical. Cloud storage offers a more convenient and accessible solution, allowing users to store their data on remote servers that they can access from anywhere, at any time, as long as they have an inter...

Waves: Layer-1? Layer-0? Both?
Many layer-1 platforms exist out there. A layer-1 platform, in the blockchain world, is a blockchain able to perform smart contracts and dApps, without any dependency on any other blockchains. Actually, Waves is and is not one of these. This may sound confusing to you. How can a blockchain be both a layer-1 platform and not? Well, the answer is complex, and to get to the answer, it is best first to know what layer-0 is.Layer-0Blockchains Layer-0 blockchain is a concept that Cosmos Network int...

Filecoin: The Decentralized Data Storage
Online file storage is a crucial matter in our world. We trust big companies like Google and Amazon to store our files on their servers. What prevents them from looking through our files? What prevents them from using them? Monetize them? What ensures that our file is safe and that somehow one of these servers that our file is on won’t get caught in the fire? All of these questions really matter. Google offers a free drive, limiting you to 15 GB of storage. Do you think that this “free” drive...

Arweave: The Permanent Data Storage
Permanent Cloud StorageIn today's digital age, cloud storage has become an essential aspect of our daily lives. With the increasing amount of data that we generate and need to store, the traditional means of data storage, such as physical hard drives or flash drives, are becoming less practical. Cloud storage offers a more convenient and accessible solution, allowing users to store their data on remote servers that they can access from anywhere, at any time, as long as they have an inter...

Waves: Layer-1? Layer-0? Both?
Many layer-1 platforms exist out there. A layer-1 platform, in the blockchain world, is a blockchain able to perform smart contracts and dApps, without any dependency on any other blockchains. Actually, Waves is and is not one of these. This may sound confusing to you. How can a blockchain be both a layer-1 platform and not? Well, the answer is complex, and to get to the answer, it is best first to know what layer-0 is.Layer-0Blockchains Layer-0 blockchain is a concept that Cosmos Network int...

Filecoin: The Decentralized Data Storage
Online file storage is a crucial matter in our world. We trust big companies like Google and Amazon to store our files on their servers. What prevents them from looking through our files? What prevents them from using them? Monetize them? What ensures that our file is safe and that somehow one of these servers that our file is on won’t get caught in the fire? All of these questions really matter. Google offers a free drive, limiting you to 15 GB of storage. Do you think that this “free” drive...
Researcher, Enthusiast, Blockchain and Crypto Lover, Cryptography Lover, Ethereum is the King.

Subscribe to Arya

Subscribe to Arya
Share Dialog
Share Dialog
<100 subscribers
<100 subscribers


Discrete logarithm is one of the most important parts of cryptography. This mathematical concept is one of the most important concepts one can find in public key cryptography. Let’s first determine a very basic algorithm to make public keys in cryptography and then describe how discrete logarithm can help us in this algorithm.
In this method, there are two people, Alice and Bob, who want to make a safe channel to exchange messages, which Eve is an untrusted person who wants to see messages. For this to happen, they need to determine a key and then use this key to exchange messages. Let’s define the algorithm below:
Firstly, Alice and Bob choose a modulus p, a very big prime number, and a base g, which is a primitive root modulo p. (If you don’t know what is a primitive root, don’t worry. We will talk about that later)
Secondly, Alice chooses a secret integer a, and sends g^a mod p to Bob. Eve can see g^a mod p.
Then, Bob chooses a secret integer b, and sends g^b mod p to Alice. Eve can see g^b mod p.
Then Alice calculates g^(ab) mod p by powering g^b mod p to a. Bob also calculates g^(ab) mod p using g^a mod p and b.
g^(ab) mod p will be the mutual key they will use to send messages.
g^a mod p is Alice’s public key and a is Alice’s secret key.
g^b mod p is Bob’s public key and b is Bob’s secret key.
In this protocol Eve cannot compute g^(ab) mod p, because Eve would need a or b to compute g^(ab) mod p, which cannot find because Eve would need to calculate log g^a mod p which is a discrete logarithm. Discrete logarithm is a “hard” problem, so Eve cannot calculate the logarithm above. We are going to talk about discrete logarithm and describe why it is a hard problem.
Before diving deep in to discrete logarithm, we are going to talk about modular arithmetic.
In modular arithmetic there is a modulo m which every integer number will be presented as the remainder in the division of the number by m. As an example if m = 10 then 23 will be presented as 3 and if m = 16 then 96 will be presented as 0. In other words 96 will be congruent to 0 modulus 16 and 23 is congruent to 3 modulus 10.
Now let’s define the function logarithm. We define

Which we call b the basis, and k the solution of the logarithm. This equation means that a = b^k.
In discrete logarithm, k will be a remainder to a modulo like p. Let’s determine an example for discrete logarithm.
Table below shows the first 12 basis and first 12 exponents modulo 13. As an example when you try to calculate 5^8 mod 13 you get 1 and calculating 7^4 gives you 9.

This table also give you the discrete logarithm mod 13. As an example

and

As you can see discrete logarithm can be not unique. If all the logarithms from exponent 0 up until exponent p-1, where p is the modulo, happen and they are unique we call that basis the primitive root. For example primitive roots of modulo 13 are 2, 6, 7, and 11. The feature of primitive roots is that when they are powered to some integer it will uniquely identify one of the integers between 1 and p-1 where p is the modulo.
Let’s determine what happens to Alice if she wants to calculate g^a mod p where g is a primitive root modulo p and p is a big prime number and a is a secret integer.
Alice will write a in the basis of 2. Then she calculates g mod p, g^2 mod p, g^4 mod p, g^8 mod p, g^16 mod p, … Calculating these numbers will only cost Alice log a computing steps because she only needs to multiplies g^x mod p to g^x mod p to get g^(2x) mod p. Then is it only necessary for Alice to use those numbers that sum of their exponents makes a in the basis of 2. So Alice only needs O(log a) steps to calculate g^a mod p. The same procedure is sufficient for Bob to computes g^b mod p.
But finding a from g^a mod p is a hard problem since g^a mod p is not unique and many exponents of g can be congruent to each other. So to find a Eve should calculate g mod p, g^2 mod p, g^3 mod p, g^4 mod p, g^5 mod p, … and use every exponent that gives the same modulus as a modulo p. So this gives Eve O(a) steps for finding a to use it finding g^(ab) mod p. The same procedure is needed to find b.
Assuming that p, g, a, and b are big 600 digits numbers, this will give Alice and Bob a very little number of steps to calculate g^(ab) mod p, maybe less than 10,000 steps. But Eve needs more that 10^600 steps to find g^(ab) mod p. To feel how big this number is, let’s emphasise that all the atoms in the known universe by the humans are about 10^80 and this number is 10^520 times bigger than that. So with the computation power humans today have, it would take Eve billions billions years to find g^(ab) mod p but it takes only less than 0.5 second for Alice and Bob to compute it.
Discrete logarithm is one of the most important parts of cryptography. This mathematical concept is one of the most important concepts one can find in public key cryptography. Let’s first determine a very basic algorithm to make public keys in cryptography and then describe how discrete logarithm can help us in this algorithm.
In this method, there are two people, Alice and Bob, who want to make a safe channel to exchange messages, which Eve is an untrusted person who wants to see messages. For this to happen, they need to determine a key and then use this key to exchange messages. Let’s define the algorithm below:
Firstly, Alice and Bob choose a modulus p, a very big prime number, and a base g, which is a primitive root modulo p. (If you don’t know what is a primitive root, don’t worry. We will talk about that later)
Secondly, Alice chooses a secret integer a, and sends g^a mod p to Bob. Eve can see g^a mod p.
Then, Bob chooses a secret integer b, and sends g^b mod p to Alice. Eve can see g^b mod p.
Then Alice calculates g^(ab) mod p by powering g^b mod p to a. Bob also calculates g^(ab) mod p using g^a mod p and b.
g^(ab) mod p will be the mutual key they will use to send messages.
g^a mod p is Alice’s public key and a is Alice’s secret key.
g^b mod p is Bob’s public key and b is Bob’s secret key.
In this protocol Eve cannot compute g^(ab) mod p, because Eve would need a or b to compute g^(ab) mod p, which cannot find because Eve would need to calculate log g^a mod p which is a discrete logarithm. Discrete logarithm is a “hard” problem, so Eve cannot calculate the logarithm above. We are going to talk about discrete logarithm and describe why it is a hard problem.
Before diving deep in to discrete logarithm, we are going to talk about modular arithmetic.
In modular arithmetic there is a modulo m which every integer number will be presented as the remainder in the division of the number by m. As an example if m = 10 then 23 will be presented as 3 and if m = 16 then 96 will be presented as 0. In other words 96 will be congruent to 0 modulus 16 and 23 is congruent to 3 modulus 10.
Now let’s define the function logarithm. We define

Which we call b the basis, and k the solution of the logarithm. This equation means that a = b^k.
In discrete logarithm, k will be a remainder to a modulo like p. Let’s determine an example for discrete logarithm.
Table below shows the first 12 basis and first 12 exponents modulo 13. As an example when you try to calculate 5^8 mod 13 you get 1 and calculating 7^4 gives you 9.

This table also give you the discrete logarithm mod 13. As an example

and

As you can see discrete logarithm can be not unique. If all the logarithms from exponent 0 up until exponent p-1, where p is the modulo, happen and they are unique we call that basis the primitive root. For example primitive roots of modulo 13 are 2, 6, 7, and 11. The feature of primitive roots is that when they are powered to some integer it will uniquely identify one of the integers between 1 and p-1 where p is the modulo.
Let’s determine what happens to Alice if she wants to calculate g^a mod p where g is a primitive root modulo p and p is a big prime number and a is a secret integer.
Alice will write a in the basis of 2. Then she calculates g mod p, g^2 mod p, g^4 mod p, g^8 mod p, g^16 mod p, … Calculating these numbers will only cost Alice log a computing steps because she only needs to multiplies g^x mod p to g^x mod p to get g^(2x) mod p. Then is it only necessary for Alice to use those numbers that sum of their exponents makes a in the basis of 2. So Alice only needs O(log a) steps to calculate g^a mod p. The same procedure is sufficient for Bob to computes g^b mod p.
But finding a from g^a mod p is a hard problem since g^a mod p is not unique and many exponents of g can be congruent to each other. So to find a Eve should calculate g mod p, g^2 mod p, g^3 mod p, g^4 mod p, g^5 mod p, … and use every exponent that gives the same modulus as a modulo p. So this gives Eve O(a) steps for finding a to use it finding g^(ab) mod p. The same procedure is needed to find b.
Assuming that p, g, a, and b are big 600 digits numbers, this will give Alice and Bob a very little number of steps to calculate g^(ab) mod p, maybe less than 10,000 steps. But Eve needs more that 10^600 steps to find g^(ab) mod p. To feel how big this number is, let’s emphasise that all the atoms in the known universe by the humans are about 10^80 and this number is 10^520 times bigger than that. So with the computation power humans today have, it would take Eve billions billions years to find g^(ab) mod p but it takes only less than 0.5 second for Alice and Bob to compute it.
No activity yet