i asked this question on the google list last year (July 2018) and got no response, so I’ll ask here again on the new forum.
I’m converting Ruby -> Crystal.
In the Ruby OPENSSL library, when I ‘require openssl’ I can then use a bunch of fast modular math methods like.
y = b.to_bn.mod_exp(d, self)
In Crystal I have to do
def powmod(b, x, m)
r = 1.to_big_i; b = b.to_big_i
while x > 0
r = (r * b) % m if x.odd?
b = (b * b) % m
x >>= 1
end
r
end
y = powmod(b, d, self) # y = (b**d) mod self`
Does Crystal have the equivalent methods as Ruby (docs don’t show them)?
Will it provide in std libs these modular math function that exist in Ruby in the future?