This project was the final course project for the Applied Cryptography course offered by Indraprastha Institute of Information Technology, Delhi during the monsoon semester of 2022.
Rabin Signature scheme was one of the first methods of digital signature proposed by Michael O. Rabin in 1979. The difficulty to forge this signature is expressed in terms of the difficulty to factorize a large number.
Given two integers
Given an odd prime
Let
Suppose
Case 1:
In this case, there exists a polytime deterministic algorithm to find the square root of
In this case
Proof -
Case 2:
In this case we can use complicated probabilistic algorithm like Berlekamp's root finding algorithm.
We first take two odd primes of the form
We then find
The pair
A hash function is also used to compress an intermediate string in the algorithm. This hash function '
The only private values are '
First the message string is concatenated with a randomly generated string
Now we want to find the values of
Now let
Now let
But
The above equations are of the same form as quadratic residue equations as seen above.
If
The expected value of doing this is 4 .
After that we can find the solution for
The signature is then the pair
To verify whether a message
find
Else return 0 (i.e., message is not authentic)
It is assumed that any adversary with high probability to forge the Rabin Signature can also with high probability find two values
This means
But
This means
So, if some adversary A can forge Rabin signature, then A can also factor large number
- We first calculate all prime numbers till
$10^{7}$ . - Then we find random odd integers of 1024 bits. Such that their most significant bit (MSB) is 1 . This is to make sure that the integers generated in this manner are large.
- We check if this number is a prime with high probability by passing it into a modified miller-rabin test.
- The modified miller-rabin test is when we first check if the number is divisible by any precomputed primes and then apply normal miller rabin test to it.
- If the number passes this test, then we can say with high probability that this input number was a prime number. Otherwise we generate some other number and check again and again.
We check if the input odd integer is divisible by any of the precomputed primes. If it is divisible by any of the primes then we are sure that this number is not prime and we return False.
Otherwise we apply the second part (Miller-rabin test) to this integer.
Input odd integer is
We write
We find values
Then
The logic of this test can be proved using two key facts
- Fermat's theorem
$\LARGE \rightarrow a^{\left(2^{k}\right) * m} \equiv a^{p-1} \equiv 1(\bmod p)$ , if$\mathrm{p}$ is prime - Only square roots of
$1 \bmod p$ are 1 and -1 .
We can say that