1234567891011121314151617181920 |
- //我是个傻逼
- #include <bits/stdc++.h>
- using namespace std;
- int encrypt(int m,int e,int n){int c=1;for(int i=0;i<e;i++){c=(c*m)%n;}return c;}
- char m[1024];
- int c[1024];
- int i,k,e,n;
- int main(){
- cout<<"n:";
- cin>>n;
- cout<<"e:";
- cin>>e;
- cout<<"plaintext:";
- cin>>m;
- cout<<"cidhertext:"<<endl;
- k=strlen(m);
- for(i=0;i<k;i++){c[i]=m[i];c[i]=encrypt(c[i],e,n);cout<<c[i]<<" ";}
- system("pause");
- return 0;
- }
|