Quantcast
Channel: stardot.org.uk
Viewing all articles
Browse latest Browse all 2379

8-bit acorn software: classic games • Re: CABALIST - a challenge....

$
0
0
WALKTHROUGH PART 13 — PROGRAM "MUNTVAN"

For the remainder of these programs there is no need to boot the disc before loading them.
If you have already booted the disc press CTRL+BREAK to reset the machine.

CHAIN "MUNTVAN"

We are told there are two pieces of encrypted text with identical meaning.
We are also told we need to find the encryption technique used.

Where do we start?

When solving these types of problems we want to look for patterns in the encrypted data.
Here is the start of both pieces of encrypted text:

Code:

DQVJ!RKGEGU!QH!VGZV!JCXG!DGGP!GPET[RVGF!D[!VJG!CFFKVKQP!QH!)VJG!CUEKK...erwk!slhfhv!ri!wh{w!kdyh!ehhq!hqfu|swhg!e|!wkh!dgglwlrq!ri!(wkh!dvfll...
The majority of the text looks like normal alphabetic characters.

Three things stand out:

1. The ! marks are consistent and look like word boundaries, ie spaces.
2. Both pieces of text seem to contain the same words, the 'spaces' are in the same positions.
3. All the lower case letters are 1 character after the upper case letters, D e, Q r, V w, J k etc.

Let's deal with the ! characters first.

The ASCII code for space is 32.
The ASCII code for ! is 33.

So the encryption is increasing each space character by 1 to get a ! character.
It could be using exclusive-or instead of addition, at this stage we don't know for sure.

For now we will assume the encrypted text has added 1.
This means to decrypt it we need to subtract 1 from each character.

Let's try writing a short program to experiment with this:

Code:

NEW   10 PROCdecode("DQVJ!RKGEGU!QH!VGZV!JCXG!DGGP!GPET[RVGF!D[!VJG!CFFKVKQP!QH!)VJG!CUEKK!XCNWG!QH!GCEJ!EJCTCEVGT!FKX)C!EGTVCKP!PWODGT**!VQ!VJG!CUEKK!XCNWG!QH!GCEJ!EJCTCEVGT/")   20 PROCdecode("erwk!slhfhv!ri!wh{w!kdyh!ehhq!hqfu|swhg!e|!wkh!dgglwlrq!ri!(wkh!dvfll!ydoxh!ri!hdfk!fkdudfwhu!gly(d!fhuwdlq!qxpehu((!wr!wkh!dvfll!ydoxh!ri!hdfk!fkdudfwhu/")   30 END   40 DEFPROCdecode(A$)   50 FOR I%=1 TO LEN(A$)   60 A%=ASC(MID$(A$,I%,1))   70 A%=A%-1   75 IF A%<32 THEN A%=ASC"."   80 VDU A%:NEXT:PRINT   90 ENDPROC
Line 70 performs the decoding.
Line 75 protects against characters being reduced into the control code range (0-31).

RUN the program and see what we get:

Code:

CPUI QJFDFT PG UFYU IBWF CFFO FODSZQUFE CZ UIF BEEJUJPO PG...dqvj rkgegu qh vgzv jcxg dggp gpet{rvgf d{ vjg cffkvkqp qh...
The spaces look correct but the words are still wrong.

Notice multiple occurrences of short words like PG, CZ and UIF.
If we decrease these letters by another one we get OF, BY and THE.

Change the program to decrease each character in the text by 2:

Code:

   70 A%=A%-2
RUN the program again:

Code:

BOTH.PIECES.OF.TEXT.HAVE.BEEN.ENCRYPTED.BY.THE.ADDITION.OF...cpui.qjfdft.pg.ufyu.ibwf.cffo.fodszqufe.cz.uif.beejujpo.pg...
The upper case text reveals itself, even though the spaces are wrong which is to be expected.
The lower case text is also still wrong, but notice the 'pg', 'cz' and 'uif' words again.

Remember from earlier we observed that the lower case letters are one position higher than the upper case.
The lower case text needs to be decreased by a further 1 position.

Change the program to decrease each character in the text by 3:

Code:

   70 A%=A%-3
RUN the program again and the lower case text now reveals itself:

Code:

ANSG.OHDBDR.NE.SDWS.G@UD.ADDM.DMBQXOSDC.AX.SGD.@CCHSHNM.NE...both.pieces.of.text.have.been.encrypted.by.the.addition.of...
The decrypted text states we need to add the ASCII value of each character DIV some number to that character.

This is what we have discovered:

Spaces and punctuation characters have been increased by 1.
Upper case letters have been increased by 2.
Lower case letters have been increased by 3.

ASCII codes are organised in blocks of 32:

&00-&1F (00-31) : control codes
&20-&3F (32-63) : space, numbers and punctuation
&40-&5F (64-95) : upper case letters plus @ [ \ ] ^ _
&60-&7F (96-127) : lower case letters plus £ { | } ~ del

We can see these groups match up with the grouping of our encoding offset values above.
This means the offset added to each character is probably the ASCII code DIV 32.

So, we think the encoding is:
encoded_char = ASC(char) DIV 32 + ASC(char)

To decrypt the text we must therefore subtract ASC(char) DIV 32.

Update the program to use this new decoding:

Code:

   70 A%=A%-(A% DIV 32)
RUN the program once more and we get the fully decrypted text:

BOTH PIECES OF TEXT HAVE BEEN ENCRYPTED BY THE ADDITION OF (THE ASCII VALUE OF EACH CHARACTER DIV(A CERTAIN NUMBER)) TO THE ASCII VALUE OF EACH CHARACTER.

both pieces of text have been encrypted by the addition of 'the ascii value of each character div'a certain number'' to the ascii value of each character.


QUIZ.
Can you think of any characters that would not properly decode using the simple method:
A%-(A% DIV 32)

Statistics: Posted by dv8 — Wed Nov 27, 2024 11:56 am



Viewing all articles
Browse latest Browse all 2379

Trending Articles