Mathematicaでオーバーフローエラーが発生したことはありませんでした。次のようにMathematicaオーバーフロー[]エラー:なぜ、どのようにバイパスするのですか?
は、私は、RSA暗号化の原理をデモ-ED:
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) –