Calculating pow(a,b) mod n

后端 未结 14 1153
执念已碎
执念已碎 2020-11-22 16:25

I want to calculate ab mod n for use in RSA decryption. My code (below) returns incorrect answers. What is wrong with it?

unsigned long i         


        
14条回答
  •  Happy的楠姐
    2020-11-22 17:04

    int's are generally not enough for RSA (unless you are dealing with small simplified examples)

    you need a data type that can store integers up to 2256 (for 256-bit RSA keys) or 2512 for 512-bit keys, etc

提交回复
热议问题