开发者

Is there a library or other way to do 128-bit math operations?

开发者 https://www.devze.com 2022-12-26 09:31 出处:网络
I am writing a cryptography application and need to work with 128 bit integers. In addition to standard add, subtract, multiply, divide, and comparisons, I also need a power and modulo开发者_Go百科 f

I am writing a cryptography application and need to work with 128 bit integers.

In addition to standard add, subtract, multiply, divide, and comparisons, I also need a power and modulo开发者_Go百科 function as well.

Does anyone know of a library or other implementation that can do this? If not 128-bit, is there a 64-bit option available?


Check out the GNU Multiple Precision Arithmetic Library.


Most any modern compiler is going to provide at least 64 bit through the use of the long long type.


gcc supports uint128_t, which is a 128-bit integer, though this isn't very portable.

Since I don't know any main stream cryptosystems that use 128-bit modular arithmetic, I'm wondering what scheme you are implementing.


Look for the Montgomery algorithms for multiplication and powers in a finite field. I don't know any library but I am quiet sure there are.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号