## Introduction to Cryptology: T1 Remarks

• 1.1.05. Most of you got it right. Some of you thought 'shifting with key 12' was to shift the alphabet backward, which in effect encripts the message with key 14 (26-12, see 1.1.15). For this problem, 1.3.04 (otp) and 1.4.04 (affine cipher), you can verify your result with a simple Perl script like the following.
```#!/usr/bin/perl
@input_text=split(//,\$ARGV[0]);
\$key=\$ARGV[1];
foreach (@input_text) {
if(\$_ eq " "){
print " ";
}else {
print chr((ord(\$_)-ord('a')+\$key)%26+ord('a'));
}
}
print "\n";
```
This script is not quite "Perlish", you Perl hackers may come up with a more succint script using pack/unpack.
• 1.1.15. Simply saying that the alphabet will "wrap up" is not enough. You have to use precise mathematical language to explain why.
• 1.2.04,1.2.10,1.2.13. Remember a reduction mod of n,n>0 is between 0 and n-1, inclusive.
• 1.2.23. This is a 2-point question. But there's nothing really hard in it. You do need to know how to write in mathematics, though. I'd suggest D. E. Knuth's book, "Mathematical writing" for those who are interested.
• 1.3.07. We know there are 26^8 8-character strings. How many of them are English words? You're to become a computer scientist and you know how to use a computer to find it out:
` grep '^........\$' /usr/share/dict/words |wc -l `
On my Redhat 9.0 machine, the above command tells there are 7078 8-character words. The exact number may be up and down a little, but it's close. The nice thing about /usr/share/dict/words is that all variants of a word, such as plural forms of nouns and p.p.'s of verbs, have been taken into the list.
• 1.4.07. There are typos. Check the errata first.
• A.1.07. Nobody got it right. I can't tell you the right answer. But it's more than 4!.
• A.1.13. Several of you mistook "rational numbers" to "real number". The former is countable, whereas the latter is not. There *is* a bijection mapping from all positive integers to all rational numbers.