#include using namespace std; int gcdExtended(int a, int b, int* x, int* y) { if (a == 0) { *x = 0, *y = 1; return b; } int x1, y1; int gcd = gcdExtended(b % a, a, &x1;, &y1;); *x = y1 - (b / a) * x1; *y = x1; return gcd; } int modInverse(int A, int M) { int x, y; int g = gcdExtended(A, M, &x, &y); if (g != 1) return -1; else { int res = (x % M + M) % M; return res; } } void decryption(string s,int ky1,int ky2) { string decrp=""; //cout<<"\n\n Enter cipher text : "; //cin.ignore(); //getline(cin,s); //int ky1,ky2; //cout<<"Enter the first key : "; // cin>>ky1; //cout<<"Enter the second key : "; // cin>>ky2; int res=modInverse(ky1,26); if(res==-1) { cout<<"Modular inverse of key 1 does not exist!!"; return; } char ar[]= {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; for(int i=0; i<<"\n\n The decrypted message for the given text : "<>ky1; cout<<"Enter the second key : "; cin>>ky2; char ar[]= {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; int i=s[0]-'a'; for(int i=0; i<<"\nThe encryption for the given ciphertext: "<