# CryptoAnalysis Game4: Crack the attack plan ! (+machines)

Hello,

The current rankings are as follows:

Place: Name: Points:
1 Phoenix/Alvo 4
2 Ilmari Karonen 2

CryptoAnalysis Game 4:

Introduction:

War has fallen upon the lands ! Some of the enemy communication machines
have been captured !
The enemy attack plan has been intercepted ! However it seems we are missing
a key to decipher it ?!
Your mission: "Crack their attack plan as soon as possible !"

The secret enemy attack plan is a string of hexadecimals:

98D3DFE989A877D8DBDCD587C7D3E1D3CECCBB81
E6DF89CFC0CDDE909E9C77C2E0D489A8C9CEEB90
C3CD92A4A09577A2E6909D87C1D6DEE989998792
D687CBD0D9D5DDCFBCD392D1DD87BCD9D3D3DDD3
D081A5AA999777CAE090DDCFBC81DFDFDBD5C0CF
D9908A879ED0D690CBD3BCD4E590DEDA77C2DEDC
8988

The secret enemy key is a string and it's content and length are unknown ?!?

The three enemy machines are:

1. The PosMod machine is:

Output = Input mod 256;

if Output < 0 then
begin
Output = Output + 256;
end;

2. The encryption machine is:

KeyIndex = 1;
for CharIndex = 1 to Length(vInput)
begin
Output[CharIndex] = PosMod( Input[CharIndex] + Key[KeyIndex] );
KeyIndex = KeyIndex + 1;

if KeyIndex > Length(Key) then
begin
KeyIndex = 1;
end;
end;

3. The decryption machine is:

KeyIndex = 1;
for CharIndex = 1 to Length(vInput)
begin
Output[CharIndex] = PosMod( Input[CharIndex] - Key[KeyIndex] );
KeyIndex = KeyIndex + 1;

if KeyIndex > Length(Key) then
begin
KeyIndex = 1;
end;
end;

Our top-engineers have uncovered/learned the workings of these machines,
here is a short description straight from our top-engineers:

Each character is added/subtracted with the key.
As the characters are encrypted/decrypted the key position is moved one
forward
and wrapped around if necessary.

Here is a conceptual encryption workings-example for a key with a length of
3 characters:

Output(1) = PosMod( Input(1) + Key(1) )
Output(2) = PosMod( Input(2) + Key(2) )
Output(3) = PosMod( Input(3) + Key(3) )
Output(4) = PosMod( Input(4) + Key(1) )
Output(5) = PosMod( Input(5) + Key(2) )
Output(6) = PosMod( Input(6) + Key(3) )
Output(7) = PosMod( Input(7) + Key(1) )
and so forth.

All outputs have a range of 0 to 255, large positive and
negative values are wrapped around with the PosMod machine.

Decryption happens in the same way except the "+" is now a "-".

Report to General Skybuck with your findings as soon as possible !

You will receive +5 points in case your intelligence is usuable !

Further hints might be provided by our spies inside the enemy lines !

So stay tuned for further hints from our spies ! ;) :)

Bye,
Skybuck.

.