{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

16-page6 - ASCII that has printable characters • They...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
• L&C’s example program in Section 5.2 encrypts and then decrypts a fxed message (declared as the initial value oF a string variable) using such a key cipher with a key oF length 7. Their key “letters” are small ints, which they add or subtract to the characters (viewed as numbers) to get diFFerent characters. They don’t bother with the wraparound, since adding or subtracting a small number From a letter in ASCII leaves you in the area oF
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ASCII that has printable characters. • They load their seven numbers into two queues oF Integers, and then use one to encode and one to decode. When they use a key letter, they replace it at the tail oF the queue, so they just rotate among the key letters. • OF course they could have avoided the queues by keeping a count oF letters, and every time looking at array element key [count % 7]. But using the queue is simple and clear....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online