To exploit a vulnerability of the enemy for decoding four messages.
The enemy has several people who choose these codes. These people are
not very creative and spying permitted to find out that they follow
easy patterns. All codes are -- as seen while implementing the function
encrypt above -- four numbers. The possible codes have to be stored
in an array with name "checkcodes". Here is the intelligence collected
on these guys:
-
Guy One always uses the four digits of the years of the Golden Pig between
1000 and 3000. The first of these years was 1407 and the next ones follow
each time 600 years later.
-
Guy Two uses always the sequence 1,2,3,4 as he does not think that it is
important what code to choose. The enemy is anyway able to eavesdrop
everything and to break all codes.
-
Guy Three knows that 88888 is a very lucky number. Therefore he distributes
the eigths on the four fields, but one of these fields (it is not known
which one) will carry two digits.
-
Guy Four is an American who migrated from their to the enemy country.
He is very convinced that his personal data from his previous life in
the USA is not available to anyone; so he bases his codes on his
previous life. Five dates he has selected: The birthday of his maternal
grandmother which is "13 December 1918, 11:28 hrs"; the birthday of
his paternal grandmother which is "17 April 1913, 3:06 hrs"; his
first wedding date which is "8 August 1988, 18:18 hrs"; his divorce
date which is "8 November 1998, 16:20 hrs";
his second weeding date which is "9 September 1999, 19:19 hours".
When he chooses the codes, he is supposed to round away the minutes and
to order the days and monhts by conventions used in his native country.
-
Guy Five likes random numbers. He draws a random number between 0 and 1
for the first entry, a random number between 0 and 2 for the second entry,
a random number between 0 and 4 for his third entry and a random number
between 0 and 6 for his fourth entry. His objective are two: on the one
hand, he thinks the random choices are too many for his enemies being able
to decode the messages by trying out one choice after the other, on the
other hand he believes that his second employer from a third country wants
to read these messages and so he does not choose random numbers between
0 and 200 for each entry. Thus his codes are also - by intent - vulnerable.
(Indeed, certain countries limit the number of digits used for legal
cryptography by intent in order to support their own secret services
to read messages while unauthorized people, not having this computation
power at home, cannot decypher them.)
These informations should be used to select the entries for the codes
to be checked. Those are stored one after the other in an array called
"checkcodes". The first of these entries (from the guy trusting the
Golden Pig) are already implemented:
checkcodes = new Array(1,4,0,7);
checkcodes.push(2,0,0,7,2,6,0,7);
The other entries have to be added.