Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Lab#2 Department of Computer Engineering

Implement Monoalphabetic cipher encryption-decryption

Lab#2 Implement Monoalphabetic cipher encryption-decryption

ALGORITHM USED IMPLEMENTD TOOL NAME DESCRIPTION


Monoalphabetic Cipher C++ Language as well as  It is used to encrypt
Virtual Lab – IIT Bombay the plain text to form
cipher text.
 Monoalphabetic
cipher is a substitution
cipher in which for a
given key, the cipher
alphabet is fixed
throughout the
encryption process.
 The cipher alphabet is
the plain alphabet
rotated left or right by
some number of
positions for each
alphabet in plain text.

Final Outcome:

Dwarkesh(160570107010) 1
Lab#2 Department of Computer Engineering
Implement Monoalphabetic cipher encryption-decryption

Code Snippet:

#include<bits/stdc++.h>
#include<iostream>
using namespace std;
string hacker(string n,int s){
string result="";
for (int i=0;i<n.length();i++)
{
result += char(int(n[i]+s-97)%26 +97);
}
return result;
}
int main(){

string n;
cout<<"Enter your plan text"<<endl;
cin>>n;
int s =0;
s = rand() % 100+1;

cout<<hacker(n,s);
return 0;

Dwarkesh(160570107010) 2

You might also like