Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculating very large exponents in python

Tags:

People also ask

How do you calculate exponents in Python?

To calculate exponents in Python using operator, then use exponent operator( ** ). The ** operator works with two values, just like the regular multiplication operator( * ) does.

How do you calculate a number to a big power?

Take the natural log of the first number and multiply by the second number. See which one is larger.


Currently i am simulating my cryptographic scheme to test it. I have developed the code but i am stuck at one point.

I am trying to take: g**x where

g = 256 bit number
x = 256 bit number

Python hangs at this point, i have read alot of forums, threads etcc but only come to the conclusion that python hangs, as its hard for it to process such large numbers.

any idea how can it be done? any two line piece of code, any library, anything that can be done.