[erlang-questions] crypto:mod_exp/3 returns wrong result?

moi mapandfold@REDACTED
Tue May 31 03:33:12 CEST 2011


I think the problem with crypto here is if it could not handle negative
numbers properly, it should not handle it at all.

crypto:mpint/1 is trying to use complement numbers to represent negatives.
> crypto:mpint(-1).
<<0,0,0,1,255>>
> crypto:mod_exp(-2, 3, -3) == crypto:mod_exp(254, 3, 253).
true

PS, Will Erlang be a possible choice for scientific computation? Like SciPy.

--
View this message in context: http://erlang.2086793.n4.nabble.com/crypto-mod-exp-3-returns-wrong-result-tp3557849p3562121.html
Sent from the Erlang Questions mailing list archive at Nabble.com.



More information about the erlang-questions mailing list