How to find a variable value in a MOD expression?

9 = 2 ^ X mod 11

What is X and how do you find X?

This is related to finding plain text in the RSA algorithm, and I am writing a C program for it.

+3
source share
3 answers

The answer is 6 + 10i for any integer i.

An easy way to get solutions for small modules is to iterate over all x values. You only need to check from 0 to 10 (= 11 - 1) to find the first solution if any solution exists.

x = 0
while x < 50:
    if 9 == 2**x % 11:
         print x
    x += 1

Output:

6
16
26
36
46

Obviously, this will take a long time if the module is large.

See the Discrete Logarithm page for more information . Note:

logbg . k , g; . , G , , .

, .

+6

, 2 ^ n mod 11 .

2 ^ 0 mod 11 = 1
2 ^ 1 mod 11 = 2
2 ^ 2 mod 11 = 4
2 ^ 3 mod 11 = 8
2 ^ 4 mod 11 = 5
2 ^ 5 mod 11 = 10
2 ^ 6 mod 11 = 9
2 ^ 7 mod 11 = 7
2 ^ 8 mod 11 = 3
2 ^ 9 mod 11 = 6
2 ^ 10 mod 11 = 1
2 ^ 11 mod 11 = 2

, 10.

2 ^ n mod 11 = 9 n = 6 + 10 * m, m -

+3

, , . 9 = 2 ^ X F 11 (Z/11Z), .

( ) - , , , C.

0

Source: https://habr.com/ru/post/1724165/


All Articles