随机素数发生器/模运算 [英] Random Prime Generator/Modular Arithmetic

查看:71
本文介绍了随机素数发生器/模运算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经制作并且最近在我的网站上发布了一个我做模块化的图书馆

算术和素数
http://www.geocities.com/brp13/Python/index.html 。我目前正在进行一个

的crypotology课程,我正在为一个类项目构建一个RSA公钥

密码学系统。我正在建立图书馆

来获得这样的经验。但是,我会问你们中是否有人知道从我的选择中可以很容易看到的任何漏洞的安全漏洞

的随机素数,ei,它们是否可以预测?只想要

来确保。为了比去网站更简单,我使用了ranint

函数来选择一个随机素数,然后通过米勒进行运行

rabin primality test。这是一个概率测试,这意味着它不是完​​全证据,但仍有不到百万分之一的人给出了b
的错误读数。谢谢!如果你出于某种原因需要这么想,请感觉

可以免费使用它!

I have made and recently posted a libary I made to do Modular
Arithmetic and Prime numbers on my website at
http://www.geocities.com/brp13/Python/index.html . I am currently in a
crypotology class, and am working on building a RSA public key
cryptology system for a class project. I am building the librarys just
to get the experience to do so. However, I would ask if any of you know
of any gaping security holes that can easily be seen from my selection
of random prime numbers, ei, are they somehow predictable? Just wanting
to make sure. For simpler than going to the website, I used the ranint
function to pick a random prime number, then ran it through the miller
rabin primality test. It''s a probabalistic test, which means it isn''t
full proof, but there''s still less than 1 in a million of giving a
false reading. Thanks! And if you should so want for some reason, feel
free to use it!

推荐答案

图瓦斯<涂***** @ gmail.com>写道:

...
Tuvas <tu*****@gmail.com> wrote:
...
以确保。为了比去网站更简单,我使用了ranint


我假设你的意思是random.randint这里。

函数选择一个随机素数,然后通过米勒进行了rabin素性测试。这是一个概率测试,这意味着它没有完全证据,但仍有不到百万分之一的给予
to make sure. For simpler than going to the website, I used the ranint
I assume you mean random.randint here.
function to pick a random prime number, then ran it through the miller
rabin primality test. It''s a probabalistic test, which means it isn''t
full proof, but there''s still less than 1 in a million of giving a




Miller-Rabin不是问题 - 相反,random.randint可能是......它

没有声称加密强大,无论是现在的

Mersenne实施或以前的Wichman-Hill之一。你可以使用/ dev / random等等吗? Cfr

< http://world.std.com/~cme/P1363/ranno.html>介绍

科目。 (为了速度,你可能想看一下gmpy.sf.net,但那个'/ b $ b与你随机数的强度完全不同)。

Alex



Miller-Rabin is not the problem -- rather, random.randint might be... it
makes no claims to be cryptographically strong, in either the current
Mersenne implementation or the previous Wichman-Hill one. Could you
maybe use /dev/random or the like? Cfr
<http://world.std.com/~cme/P1363/ranno.html> for an introduction to the
subject. (For speed, you may want to look into gmpy.sf.net, but that''s
quite a separate issue from the strength of your random numbers).
Alex


我发现mod函数在处理

权限时并不完全正确,但是,我会拥有它很快修复了。

I have discoved that the mod function isn''t quite right in dealing with
powers, but, I''ll have it fixed shortly.


好吧,RSA元素'永远不会加密超过一个小的,1

块系统除非在极少数情况下,主要加密将是b = AES
。谢谢你的帮助!

Well, the RSA element''s never going to encrypt more than a small, 1
block system except under rare occasions, the primary encryption will
be AES128. Thanks for the help though!


这篇关于随机素数发生器/模运算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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