Introduction of Cipher Security - Find Large Prime Number

For security of our cryptosystems, we will need to choose a large random prime number (secret keys) efficiently.

Les's assume we need a prime number which is 1000bits.

 

Before choosing prime numbers, we need to find an algorithm to check a number whether is prime numbers or not, so we use the algorithm that called Theorem(Euler/Fermat Theorem), let me introduce the theory.

 

I will introduce a notation firstly, Φ(n) means to find the number of prime numbers which are less than n, for example:

Φ(5) = {1,2,3,4} = 5

Φ(8) = {1,2,3,4,5,6,7}  --> {1,3,5,7} = 4

BTW, for any prime number Φ(n) = n - 1

 

And then we have: for any prime number p,q, and n = p*q then

Φ(n) = Φ(p*q)=  (p-1) * (q-1) = p*q-(p+q-1)

For example,

p = 3, q = 7

n = 21

not (Φ(3} and Φ(12)) = {0,0,3,6,7,9,14,15,18}

Φ(3) and Φ(12) = {1,2,4,5,8,10,11,13,16,17,19,20} = 12

Φ(n) = Φ((3-1)*(7-1)) = 12 

 

Then, Let me introduce the theory.

- Theorem(Euler/Fermat Theorem): if M and n are relatively prime integers then and y(mod Φ(n)) = 1 for M < n then M^(Φ(n)) mod n = 1.

Consequently, we have: 

- M^(Φ(n)) mod n = M(Φ(n))*M mod n = 1* M mod n = M

- if y mod(mod Φ(n)) = 1, i.e y = Φ(n) * k + 1 for interget k then

- M^y mod n = M^(Φ(n)*k+1) mod n = (M^(Φ(n)))^k * M mod n = 1^k * M ^1 mod n = M

For conclusion, we have: M^(Φ(n)) mod n = 1(If M and n are relatively prime number)

(That's important, because that's the algorithem we use to test large random prime number)

 

Then, the question becomes easier, the way we choose a large prime number is choosing a random number (P). We assume that p is a prime number, and choose multiple numbers to confirm with our assuming by implementing the algorithm (Theorem).

If for all we have a^(p-1) mod p = 1, which means the number p is a prime number.  

Does it very hard to get a large prime number?

Actually, the probability of a random number is a prime number is 1/(ln(2)*L) ≈ 1/(0.693*L) ≈ 1/693 

(L is the bits of a prime number we need, in there the L is 1000 because we need 1000bits prime number)

 

That's all how we generate a  large prime number for cipher security.

Thanks for reading.

 

  • 0
    点赞
  • 0
    收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qq_40831558

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值