我正在使用以下程序生成4个字节长(无符号长)的RSA密钥。所以我的问题是如何修改程序以使用大整数?
void keygen(unsigned long int e, unsigned long int p, unsigned long int q)
{
unsigned long int phi,d,n,s;
n = p*q;
phi=(p-1)*(q-1);
d = phi / e ;
do
{
d++;
}
while( ((d*e) % phi) != 1 );
printf("\n public key: { e=%u n=%u }",e,n);
printf("\n private key: { d=%u n=%u }",d,n);
printf("\n verify modulo = %d\n",((d*e) % phi)); /* this need to be 1 */
}
void main()
{
keygen(3, 17, 19);
system("pause");
}