实验吧—密码学—rsarsa

Math is cool! Use the RSA algorithm to decode the secret message, c, p, q, and e are parameters for the RSA algorithm.

解题链接: http://ctf5.shiyanbar.com/crypto/rsarsa/rsa.txt

 

点击链接后会看到这些

p =  9648423029010515676590551740010426534945737639235739800643989352039852507298491399561035009163427050370107570733633350911691280297777160200625281665378483
q =  11874843837980297032092405848653656852760910154543380907650040190704283358909208578251063047732443992230647903887510065547947313543299303261986053486569407
e =  65537
c =  83208298995174604174773590298203639360540024871256126892889661345742403314929861939100492666605647316646576486526217457006376842280869728581726746401583705899941768214138742259689334840735633553053887641847651173776251820293087212885670180367406807406765923638973161375817392737747832762751690104423869019034

Use RSA to find the secret message

发现这题p,q,e,c都给我们了。于是不需要什么enc和pem文件。感觉真的是帮帮得。

开始我们得代码

import math
p=9648423029010515676590551740010426534945737639235739800643989352039852507298491399561035009163427050370107570733633350911691280297777160200625281665378483
q=11874843837980297032092405848653656852760910154543380907650040190704283358909208578251063047732443992230647903887510065547947313543299303261986053486569407
e=65537
c=83208298995174604174773590298203639360540024871256126892889661345742403314929861939100492666605647316646576486526217457006376842280869728581726746401583705899941768214138742259689334840735633553053887641847651173776251820293087212885670180367406807406765923638973161375817392737747832762751690104423869019034
n=p*q
fn=long((p-1)*(q-1))

i = 1
while(True):
    x=(i*fn)+1
    if(x%e==0):
        d=x/e
        break
    i=i+1
print pow(c,d,n)

在cmd中进行运行,出来了,开心不!

注:本人纯小白,为自己更好的理解和掌握进行编写。不喜勿喷!

 

原文地址:https://www.cnblogs.com/nldyy/p/8594643.html