Modular exponentiation: Difference between revisions
Content deleted Content added
Line 292: | Line 292: | ||
# Compute self**e mod m |
# Compute self**e mod m |
||
def powmod(e, m) |
def powmod(e, m) |
||
r, b = 1, self.to_big_i |
r, b = 1, self.to_big_i |
||
while e > 0 |
while e > 0 |
||
r = (b * r) % m if e.odd? |
r = (b * r) % m if e.odd? |