我從來沒有在Mathematica中發生溢出錯誤,發生下列情況。Mathematica溢出[]錯誤:爲什麼和如何繞過?
我演示-ED的RSA加密原理如下:
n = 11*13
m = EulerPhi[n]
e = 7
GCD[e, m]
d = PowerMod[e, -1, m]
cipher2[m_String] := Map[Mod[#^e, n] &, ToCharacterCode[m]]
decipher2[x_Integer] := FromCharacterCode[Map[Mod[#^d, n] &, x]]
In[207]:= cipher2["StackOverflow"]
decipher2[cipher2["StackOverflow"]]
Out[207]= {8,129,59,44,68,40,79,62,49,119,4,45,37}
Out[208]= StackOverflow
沒問題SOFAR。
然後,我改變了素數到更現實,但仍然非常適中的大小。
n = 252097800611*252097800629
In[236]:= cipher2["StackOverflow"]
decipher2[cipher2["StackOverflow"]]
Out[236]= {27136050989627, 282621973446656, 80798284478113, \
93206534790699, 160578147647843, 19203908986159, 318547390056832, \
107213535210701, 250226879128704, 114868566764928, 171382426877952, \
207616015289871, 337931541778439}
During evaluation of In[236]:= General::ovfl: Overflow occurred in computation. >>
During evaluation of In[236]:= General::ovfl: Overflow occurred in computation. >>
Out[237]= FromCharacterCode[{Overflow[], Overflow[], Overflow[],
Overflow[], Overflow[], Overflow[], Overflow[], Overflow[],
Overflow[], Overflow[], Overflow[], Overflow[], Overflow[]}]
問題:我是否簡單地通過了Mathematica的限制?我用過不正確的方法嗎?什麼是旁路,如果有的話?
感謝阿諾德·,(你的名字暗示你有祖先在我住的比利時或者NL。) –