RSA计算d [英] RSA calculate d

查看:1275
本文介绍了RSA计算d的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不知道这是否是正确的地方提出加密问题,但是这里。

Not sure if this is the correct place to ask a cryptography question, but here goes.

我正在尝试在RSA中找出d,我有制定p,q,e,n和øn;

I am trying to work out "d" in RSA, I have worked out p, q, e, n and øn;

p = 79, q = 113, e = 2621

n = pq                   øn = (p-1)(q-1)
n = 79 x 113 = 8927      øn = 78 x 112 = 8736

e = 2621
d =

我似乎找不到d,我知道d意在成为一个值ed modø(n)= 1.任何帮助将不胜感激

I cant seem to find d, I know that d is meant to be a value that.. ed mod ø(n) = 1. Any help will be appreciated

编辑:一个例子是e = 17,d = 2753,øn= 3120

edit: an example would be e = 17, d = 2753, øn = 3120

17 * 2753 mod 3120 = 1

17 * 2753 mod 3120 = 1

推荐答案

您正在寻找模块化的的 e (mod n ),可以使用扩展的欧几里得算法计算:

You are looking for the modular inverse of e (mod n), which can be computed using the extended Euclidean algorithm:

function inverse(x, m)
    a, b, u := 0, m, 1
    while x > 0
        q := b // x # integer division
        x, a, b, u := b % x, u, x, a - q * u
    if b == 1 return a % m
    error "must be coprime"

因此,在您的示例中, inverse(17,3120) = 2753和 inverse(2621,8736) = 4373.如果你不想实现算法,您可以询问 Wolfram | Alpha 的答案。

Thus, in your examples, inverse(17, 3120) = 2753 and inverse(2621, 8736) = 4373. If you don't want to implement the algorithm, you can ask Wolfram|Alpha for the answer.

这篇关于RSA计算d的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆