如何在4天内破解现有硬件上的RSA-512

2022-02-13 19:01:03

TL;DR:在4天内,在6核AMD Ryzen 5 3600(64GB内存)上分解512位(复合)数字。

%openssl rsa-noout-text-in密钥对。:adadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvn)指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数)指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数d1:4c:2e:6a:a7:6b:bd:cb:da:3d:6c:例如:adadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadad552:00:fd:3a:c0:67:27:b5:25:ab:72:10:a3:77:8c:b7:adadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadvvvvvvvvvvvvvvvvvv)adadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv系数:7b:be:00:7a:51:cd:5c:b0:ac:f7:be:67:2d:0c:ce:a1:34:cc:ab:7e:06:d4:88:cf:97:b0:b4:43:d9:96:bd:9c%openssl rsa-noout-text-Notify PEM-pubin-in pubkey。公钥:(512位)模数:00:fd:1a:2f:5a:b9:01:4f:85:f7:72:a4:c2:6f:58:43:c8:6a:4c:dc:2b:3f:96:08:8e:e9:ed:4e:c2:92:e4:3c:02:c8:2e:09:63:23:ad:45:6b:92:fa:a7:88:3a:0c:4b:08:cf:aa:fd:b5:64:cd:28:5e:c8:c8:c8:c8:5e:c8:c8:c8:e8:5a8:e8:e8:e8:5a:e8:e8:e8:5a:e8:e8:e8:e8:e8:5

暂时忘记私钥。只取公钥。将'的十六进制数连接起来;模数';,忽略冒号(';:';)象征将其转换为Wolfram Mathematica中的十进制数:

现在等4天。或者更多,如果你的硬件速度较慢。或者更少,如果更快的话。

...信息:过滤-重复删除,删除过程:dup2的CPU时间:802.59999999SINFO:线性代数:bwc的总CPU/实时:162309/30174信息:线性代数:聚合统计信息:线性代数:Krylov:CPU时间104154.41,WCT时间19350.89,迭代CPU时间0.14,通信0.01,CPU等待0.01,通信等待0.0(118784次迭代)信息:线性代数:林根CPU时间1233.97,WCT时间107.94信息:线性代数:Mksol:CPU时间55810.1,WCT时间10470.62,迭代CPU时间0.15,通信0.01,CPU等待0.01,comm wait 0.0(59392次迭代)信息:生成自由关系:freerel的总cpu/实时:480.9/42.4643信息:生成因子库:makefb的总cpu/实时:28.51/3.17731信息:平方根:sqrt的总cpu/实时:6552.17/687.81信息:多项式选择(根优化):聚合统计信息:多项式选择(根优化):总时间:9368.04信息:多项式选择(根优化):根筛选时间:9366.28信息:筛选-单例删除:清除的总cpu/实时:883.34/900.631信息:HTTP服务器:关闭HTTP服务器信息:完成因式分解/离散对数:整个因式分解的总cpu/运行时间:3.55505e+06/549.64211453895573767833204351134448177200907101690028206764172540480084319013256187 11573391951427310712358932610501838699964100906320600963295194448416597

下面的代码可以做到这一点:它重建RFC 2437中所述的所有额外(预计算)常量,并为RSA私钥生成一个新的PEM文件。

我';我在IRC#crypto(Libera)上找到了它,它是Wulf写的,非常感谢他。我只是通过放弃LCM操作简化了一点。

#!/usr/bin/python3#下面的代码是Wulf在#crypto(Libera)上编写的,来自math import gcdfrom cryptography。危险品。后端从加密中导入默认值。危险品。原语。不对称rsa从密码学导入(rsPublicNumbers、rsPrivateNumbers、rsa_crt_iqmp、rsa_crt_dmp1、rsa_crt_dmq1等)。危险品。原语。序列化导入编码,PrivateFormat,NoEncryptiondef gcdext(a,b):x0,x1,y0,y1=1,0,0,1,而b:q,a,b=a//b,b,a%bx0,x1=x1,x0-q*x1-y0,y1=y1,y0-q*y1返回a,x0,y0def反转(a,n):g,x,u=gcdext(a,n)如果g!=1:raise ValueError(";参数不是互质";)返回x%ne=65537#订单不';重要事项:p=1157339195142731071235843932610501578386997964100906320600963295194448416597Q=1145389557378332043511344817720090710169002820676417254048084319013256187N=p*qpub_num=RSAPublicNumbers(e,n)d=ateinvert(e,(p-1)*(q-1))iq=rsa_crt_iqmp(p,q)dp=rsa_crt_DMU(d,p)dq=rsa_crt_crt_-DMU(d,dq=RSAU)PRSU(p,q,d,dp,dq,iq,pub_num)prv=prv_num.private_key(默认_backend())#跳过最新版本中的arg打印(prv.private_字节(Encoding.PEM,PrivateFormat.PKCS8,NoEncryption())。解码())

%openssl rsa-noout-text-in new_priv_密钥。:adadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvn)指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数)指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数指数d1:4c:2e:6a:a7:6b:bd:cb:da:3d:6c:例如:adadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadad552:00:fd:3a:c0:67:27:b5:25:ab:72:10:a3:77:8c:b7:adadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadvvvvvvvvvvvvvvvvvv)adadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv系数:7b:be:00:7a:51:cd:5c:b0:ac:f7:be:67:2d:0c:ce:a1:34:cc:ab:7e:06:d4:88:cf:97:b0:b4:43:d9:96:bd:9c

%xxd-G1HW。txt。签名00000000:9d 30 22 87 12 c1 bf bb 87 e0 54 76 a0 fb a5 cd.0";。。。。。。。电视00000010:F051 fc 44 e3 52 8f ba dc 82 b7 ca 0a 6a bd 64。Q.D.R。。。。。。。j、 d00000020:48 c9 30 8a 83 0a 5c 43 7d d6 5a 4a e8 cb d1 cd H.0。。。\C} 。ZJ。。。。00000030:c6 a3 37 ac 49 8f a7 f8 d8 32 76 45 6e 0a bc 95。。7.我。。。。即使。。。

%openssl dgst-签署新的私钥。pem-keyform pem-sha256-out hw。txt。符号-二进制硬件。txt%xxd-G1 hw。txt。签名00000000:9d 30 22 87 12 c1 bf bb 87 e0 54 76 a0 fb a5 cd.0";。。。。。。。电视00000010:F051 fc 44 e3 52 8f ba dc 82 b7 ca 0a 6a bd 64。Q.D.R。。。。。。。j、 d00000020:48 c9 30 8a 83 0a 5c 43 7d d6 5a 4a e8 cb d1 cd H.0。。。\C} 。ZJ。。。。00000030:c6 a3 37 ac 49 8f a7 f8 d8 32 76 45 6e 0a bc 95。。7.我。。。。即使。。。

早在大约20年前的1999年,RSA-512就已被考虑在内。但他们需要6个月的时间,唐';我不知道有多少硬件。

CADO-NFS是当今用于因子分解的强大工具。截至2022年2月,它保持着目前的RSA factoring世界记录:829位(但运行在一个大集群上)。

它';如今,人们普遍认为RSA-1024已经不够了。考虑至少使用RSA-1536或RSA-2048。

CADO-NFS可以按任意顺序打印数字。订单没有';重要的是:Python中的重构工具可以按相反的顺序获取这些数字。但文本转储将略有不同(数字顺序)。但不管怎样,它都会起作用。