Encryption is commonly used to disguise messages on the internet. A Caesar cipher performs a shift of all of the characters in a string (based on their ASCII values, see Table 2.1), e.g. h e l l o → m j q q t The example shows a shift with a distance of 5 characters, i.e. h(ASCII:104) → m(ASCII:109) Write a C/C++ program that asks the user to input a line of plaintext and the distance value and outputs an encrypted text using a Caesar cipher, with the ASCII values range from 0 through 127. Use underscores (ASCII: 95) to represent space characters. Underscore characters should not be encrypted, and any character that is encrypted may not become an underscore. In this case, the character should be changed to the next character in the ASCII table. The program should work for any printable characters. NB: No strings (datatype) or library functions may be used.

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter3: Data Representation
Section: Chapter Questions
Problem 5PE
icon
Related questions
Question

Encryption is commonly used to disguise messages
on the internet. A Caesar cipher performs a shift of
all of the characters in a string (based on their ASCII
values, see Table 2.1), e.g.
h e l l o → m j q q t
The example shows a shift with a distance of 5
characters, i.e. h(ASCII:104) → m(ASCII:109)
Write a C/C++ program that asks the user to input a
line of plaintext and the distance value and outputs
an encrypted text using a Caesar cipher, with the
ASCII values range from 0 through 127. Use
underscores (ASCII: 95) to represent space
characters.
Underscore characters should not be encrypted,
and any character that is encrypted may not
become an underscore. In this case, the character
should be changed to the next character in the
ASCII table.
The program should work for any printable
characters.
NB: No strings (datatype) or library functions may
be used.
See Figure 2.1 for example output.

16
17
ASCII-Tabel / ASCII Table
80
81
32
48
64
96
97
NUL
DLE
SP
112
P
SOH
DC1
33
49
65
A
113
STX
18
DC2
34
50
2
66
82
98
b.
114
ETX
19
DC3
35
51
67
83
99
115
EOT
20
DC4
36
52
68
D.
84
100
116
ENQ
21
NAK
37
53
5
69
85
101
117
ACK
22
SYN
38
54
6
70
86
V
102
118
BEL
23
ETB
39
55
71
G
87
103
119
BS
24
CAN
40
56
2ר
88
104
120
HT
25
EM
41
57
73
89
105
121
10
26
SUB
42
58
74
90
106
122
11
VT
27
ESC
43
59
5ר
91
107
123
12
FF
28
FS
44
60
< 76
L.
92
108
|1
124
13
CR
29
GS
45
61
77
93
109
125
14
SO
30
RS
46
62
78
94
110
126
15
SI
31
US
47
63
?| 79| o
95
111
127
DEL
Tabel 2.1/ Table 2.1
V A
Transcribed Image Text:16 17 ASCII-Tabel / ASCII Table 80 81 32 48 64 96 97 NUL DLE SP 112 P SOH DC1 33 49 65 A 113 STX 18 DC2 34 50 2 66 82 98 b. 114 ETX 19 DC3 35 51 67 83 99 115 EOT 20 DC4 36 52 68 D. 84 100 116 ENQ 21 NAK 37 53 5 69 85 101 117 ACK 22 SYN 38 54 6 70 86 V 102 118 BEL 23 ETB 39 55 71 G 87 103 119 BS 24 CAN 40 56 2ר 88 104 120 HT 25 EM 41 57 73 89 105 121 10 26 SUB 42 58 74 90 106 122 11 VT 27 ESC 43 59 5ר 91 107 123 12 FF 28 FS 44 60 < 76 L. 92 108 |1 124 13 CR 29 GS 45 61 77 93 109 125 14 SO 30 RS 46 62 78 94 110 126 15 SI 31 US 47 63 ?| 79| o 95 111 127 DEL Tabel 2.1/ Table 2.1 V A
Enter the sentence to encrypt: Hello!_Your_pin_number_is:_76866
Enter the shift value: 3
The encrypted sentence is: Khoor$_\rxu_slq_qxpehu_lv=_:9;99
Figuur 2.1/ Figure 2.1
Transcribed Image Text:Enter the sentence to encrypt: Hello!_Your_pin_number_is:_76866 Enter the shift value: 3 The encrypted sentence is: Khoor$_\rxu_slq_qxpehu_lv=_:9;99 Figuur 2.1/ Figure 2.1
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Public key encryption
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning