ras.c
来自「RSA算法的C语言实现 RSA算法的C语言实现」· C语言 代码 · 共 29 行
C
29 行
#include <stdio.h>
#include <math.h>
main()
{
int apube=7;
int apubn=123;
int bpube=13;
int bpubn=51;
int aprid=23;
int aprin=123;
int bprid=5;
int bprin=51;
int msg;
long buff;
printf("Input the message:");
scanf("%d",&msg);
buff=(long)pow(msg,aprid)%aprin;
printf("Using private key of A:%d\n",buff);
buff=pow(buff,bpube)-(int)(pow(buff,bpube)/bpubn)*bpubn;
printf("Using public key of B:%d\n",buff);
printf("B get the msg.\n");
buff=pow(buff,bprid)-(int)(pow(buff,bprid)/bprin)*bprin;
printf("Using private key of B:%d\n",buff);
buff=pow(buff,apube)-(int)(pow(buff,apube)/apubn)*apubn;
printf("Using public key of A:%d\n",buff);
printf("The msg is sent by A.");
getch();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?