Writing a c++ program using visual studio
String lab 2 Encryption
This is the encryption lab where you will be implementing 3 types of encryption. You will read in the Text.txt file and encrypt it using each of the 3 following methods. The text file will contain no new line characters (one long line) and no other special characters (\t or \r). First, start by outputting the original text in the file to the screen. Then send the text to a function which carries out the first encryption and output those results. Next send the encrypted text to a second function which decrypts it – after all, encrypting text has no use if you can’t decrypt it. Finally, output the decrypted string once more. Repeat this for each of the 3 types of encryption.
Encryption 1:
A generic cypher can be implemented by having a number represent each character. A=1, B=2, C=3, D=4...
214 = BAD
It gets more complicated once you pass 9 however because 10 is more than 1 digit Therefore we start to use letters:
A=1
B=2
C=3
D=4
E=5
F=6
G=7
H=8
I=9
J=A
K=B
L=C
M=D
…
In this encryption anything other than letters are left as they are.
Encryption 2:
The next encryption is to increase character values according to a formula (sequence). If the character is anything other than a letter it would set it to ‘a’ and if the letter was z it would increase it to a space ‘ ‘. So, if our sequence was: (num*=2) = {1,2,4,8,16…}
It would take a string like:
0123456789*012345678
This is a string yay
Tijsais b string zay
Your job is to implement this encryption with the sequence:
{1, 2, 4, 7,11,16,22,23,25,28…}
{-,+1,+2,+3,+4,+5,+6,+1,+2,+3…} It is a increasing increment that resets when the increment reaches 6.
Encryption 3:
This encryption is a pattern transformation. It works by changing the digits by some kind of pattern every time. My pattern may look like:
“114A01”
This means that the first character ‘1’ will increase the corresponding text’s first character by 1. The ‘4’ in the encryption pattern will increase the 3rd character in the text by 4, and so on. The ‘A’ (or any other letters in the pattern) will not change the character at that position but will instead insert an ‘A’ at that position (moving all other characters down). The pattern is only so long so if the text to encrypt is longer than the pattern will be duplicated. So an example would be:
Original text: “This is a great day”
Encryption: “114A01114A01114A01114A01”
Encrypted text: “UimAsajtdAaahsiAauaeeAy
T + 1 = U
h + 1 = i
i + 4 = m
insert an A
s + 0 = s
space + 1 = a
i + 1 = j
s + 1 = t
space + 4 = d
insert an A
a + 0 = a
space + 1 = a
g + 1 = h
r + 1 = s
e + 4 = i
insert an A
a + 0 = a
t + 1 = u
space + 1 = 1
d + 1 = e
a + 4 = e
insert an A
y + 0 = y
1 unused
Encryption 4: