logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

develop a program that repeatedly allows the user to encode a single message, decode a single message, decode an entire protected file, or quit the cipher will be based on the Lewis Carroll method.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

ECE 103 Expanded Homework HW-4                                                                                              

Problem List

50 points

Text encoding/decoding problem

General Instructions

  • Your program must conform to either the ISO C99 or ISO C90

  • Good programming style is important. Comment your program

  • Put a title block at the top of each source code file. It should include the course number, homework number, your full name, and a short program

  • Each function that you write should have a short title block that describes the function’s purpose.

  • What you need to submit for grading:

    • Program Design Report (format: Word .doc/.docx or pdf )

    • Source code with this file name: c

  • Store your completed files (source code, reports, etc.) in a single ZIP archive

    • Do not include the executable file (e.g., out or a.exe) or IDE project files.

    • WARNING: If you do not zip your files, you will receive a point

  • Upload your ZIP file to the appropriate D2L Submission Folder by the

NOTE

For an example of what a typical Program Design Report should look like, refer to the file “Sample_Program_Design_Report.pdf”, which is stored on D2L in the Syllabus and Course Info module.

Problem Statement

For as long as people have held important secrets, there has been a desire to send encrypted messages that cannot be deciphered by anyone except by the intended recipient. While modern encryption schemes are relatively secure, they are also mathematically highly complex, and writing a correct computer implementation can be very challenging. So instead of subjecting you to that degree of coding difficulty, you will instead investigate a simple “substitution” cipher for protecting a secret message.

You need to develop a program that repeatedly allows the user to encode a single message, decode a single message, decode an entire protected file, or quit. The cipher will be based on the Lewis Carroll method.

Background

Suppose the original message is encoded using a set of symbols such as the English alphabet1. In the substitution method, each symbol in the alphabet is assigned a different symbol2 according to some predetermined scheme. The encoding process consists of replacing each character in the original message by its associated substitution value. The encoded message can then be sent to the recipient, who can unscramble the message by performing a reverse lookup, but only if they know how the encoding table was constructed.

Example:

Orig

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

Subs

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

In the simple table above, the original alphabet symbols form the top row. The substitution symbols are placed in the second row. They are the same set of characters, but are shifted over by two positions to the left, with the A and B wrapping around on the right side.

  • To encode: In the first row of the table, find the desired character from the original message, then look downward in the same column to determine its substitution

Original message:        PORTLAND      (P to be replaced by R, O to be replaced by Q, etc.)

Encoded message:      RQTVNCPF

  • To decode: In the second row of the table, find the desired character from the encoded message, then look upward in the same column to determine its original

Encoded message:      RQTVNCPF      (R to be replaced by P, Q to be replaced by O, etc.)

Original message:        PORTLAND

If the message is intercepted before it reaches the intended recipient, then as long as that person does not know the exact encoding/decoding table, the message will remain secure. Of course, the extremely simple substitution shown in the previous example could be figured out by a young child and offers little or no security. To get around this problem, more sophisticated substitution algorithms have been developed, including one attributed to noted author Charles L. Dodgson, better known as Lewis Carroll.

For this assignment, a 2-dimensional “lookup” table of substitution values will be used along with a passcode. We also need to handle numeric digits and punctuation in the original message. To do this, we will refer to the ASCII chart shown below.

Table 1: ASCII characters (32 - 126) collating sequence

 

Dec

Char

Description

Dec

Char

Description

Dec

Char

Description

32

 

Space

64

@

At

96

`

Grave accent

33

!

Exclamation mark

65

A

Upper case A

97

a

Lower case a

34

"

Quotation Mark

66

B

Upper case B

98

b

Lower case b

35

#

Hash

67

C

Upper case C

99

c

Lower case c

36

$

Dollar

68

D

Upper case D

100

d

Lower case d

37

%

Percent

69

E

Upper case E

101

e

Lower case e

38

&

Ampersand

70

F

Upper case F

102

f

Lower case f

39

'

Apostrophe

71

G

Upper case G

103

g

Lower case g

40

(

Open parentheses

72

H

Upper case H

104

h

Lower case h

41

)

Close parentheses

73

I

Upper case I

105

i

Lower case i

42

*

Asterisk

74

J

Upper case J

106

j

Lower case j

43

+

Plus

75

K

Upper case K

107

k

Lower case k

44

,

Comma

76

L

Upper case L

108

l

Lower case l

45

-

Dash

77

M

Upper case M

109

m

Lower case m

46

.

Full stop

78

N

Upper case N

110

n

Lower case n

47

/

Slash

79

O

Upper case O

111

o

Lower case o

48

0

Zero

80

P

Upper case P

112

p

Lower case p

49

1

One

81

Q

Upper case Q

113

q

Lower case q

50

2

Two

82

R

Upper case R

114

r

Lower case r

51

3

Three

83

S

Upper case S

115

s

Lower case s

52

4

Four

84

T

Upper case T

116

t

Lower case t

53

5

Five

85

U

Upper case U

117

u

Lower case u

54

6

Six

86

V

Upper case V

118

v

Lower case v

55

7

Seven

87

W

Upper case W

119

w

Lower case w

56

8

Eight

88

X

Upper case X

120

x

Lower case x

57

9

Nine

89

Y

Upper case Y

121

y

Lower case y

58

:

Colon

90

Z

Upper case Z

122

z

Lower case z

59

;

Semicolon

91

[

Open bracket

123

{

Open brace

60

Less than

92

 

Backslash

124

|

Pipe

61

=

Equals sign

93

]

Close bracket

125

}

Close brace

62

Greater than

94

^

Caret

126

~

Tilde

63

?

Question mark

95

_

Underscore

 

 

 

 The amount of available symbols is adequate to handle the content of most messages. What is important to note here is that the symbols are ordered, so that each symbol can be associated with a unique and sequentially ascending number.

Lewis Carroll Algorithm

 The encoding and decoding table for our version of the Lewis Carroll substitution algorithm is constructed like this:

Table 2: Encoding/Decoding Table

¬ Column Index ®

Across the top and along the left side are, in order, the ASCII characters SPACE (sp) through TILDA (~). Each row in the interior of the table is the same as the previous row, except that each character is shifted one position to the left and the last character of a row is the first character of the preceding row. If you want to see what the full table looks like, download the file named Lookup_Table.pdf that is in the HW-4 content module on D2L.

Encoding

To encode the text, you choose an arbitrary passcode string, which is used as a key to lock or unlock the secret message. As an example, suppose the chosen passcode is Walrus and the message to encode is:

Meet me in St. Louis!

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

847 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

690 Answers

Hire Me
expert
Husnain SaeedComputer science

772 Answers

Hire Me
expert
Atharva PatilComputer science

804 Answers

Hire Me

Get Free Quote!

319 Experts Online