一道简单的密码学
[TOC]
一道简单的密码学:
代码coding:
import math |
IDEA:
ord作为built-in function,返回Unicode字符对应的整数。 |
solution:
import numpy as np
data=[2.178203880729008e+47, 1.6094870669615087e+48, 7.307059979368028e+43, 9.889030319346894e+42, 2.3886906014249767e+50, 1.9862648361376436e+44,
2.6195173187490456e+53, 9.889030319346894e+42, 7.016735912097614e+20, 2.178203880729008e+47, 7.307059979368028e+43, 1.811239082889014e+41,
1.6094870669615087e+48, 5.920972027664636e+47, 214643579785915.7, 3.6379709476087856e+42, 7.307059979368028e+43, 5.399227610580139e+44,
3.989519570547194e+45, 5.920972027664636e+47, 1.811239082889014e+41, 3.5451311827611436e+52, 1.6094870669615087e+48, 6.493134255664421e+50,
3.23274119108484e+49, 1.811239082889014e+41, 1.2523631708422093e+29, 3.23274119108484e+49, 3.5451311827611436e+52, 4.375039447261315e+48,
2.3886906014249767e+50, 7.016735912097614e+20, 1.811239082889014e+41, 9.889030319346894e+42, 3.831008000716566e+22, 3.23274119108484e+49,
1.4093490824269349e+22, 1.4093490824269349e+22, 3.23274119108484e+49, 1.9355760420357097e+54]
cip=[]
for i in range(len(data)):
cip.append(int(np.log(data[i])))
print(cip)
flag=[]
for i in range(len(cip)):
flag.append(chr(cip[i]))
print(flag)
import numpy as np |
之所以使用int类型是因为调用numpy库求对数得到的结果默认为浮点数,产生TypeError: integer argument expected, got float
的错误,所以转为int类型。
|
参考资源:
https://blog.csdn.net/weixin_42228776/article/details/113713023