在学习ElGamal数字签名的时候,遇到大整数计算速度慢的问题
v2 = (pow(y_a,s1)*pow(s1,s2))%q
y_a,s1,s2 均为长度为30左右的整数,q为128位二进制数
有什么办法可以加速计算大整数运算么?
或者说可以处理一下hash函数MD5输出的结果?使y_a,s1,s2长度减小?
import math
text = input("请输入信息")
count = math.ceil(len(text) / 70)
print("当月发送短信的总次数:%s" % count)
tatol_amount = round(float(count) * 0.1, 1)
print("当月短信总资费:%s" % tatol_amount)
count_words = len(text)
for i in range(count):
# i = i + 1
words = 70
if 70 > count_words - i * 70:
words = count_words - i * 70
print("第%d条信息字数为:%s" % (i+1, words))
发错了,不好意思