I’ve got a lot on my plate in terms of entertainment (Deus Ex: Human Revolution and Final Fantasy Tactics for iOS being the main culprits), so I haven’t finished Ghost in the Wires yet. But I threw together a Matlab script that will decode some of the messages at the start of each chapter, so I thought I’d share.

% Start fresh
clear
clc

% Chapter 1 coded message
coded_text = ['yjcv ku vjg pcog qh vjg uauvgo wugf da jco qrgtcvqtu ' ...
    'vq ocmg htgg rjqpg ecnnu?'];

% ========================================================================

% Alphabet
truth = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', ...
    'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', ...
    'y', 'z'};
decoder = truth;

% Loop over the 26 letters of the alphabet
decoded = cell(1, 26);
for ii = 1:26
    % Circularly shift the letters
    decoder = {decoder{2:end} decoder{1}};
    
    % Decode the message
    decoded{ii} = coded_text;
    for jj = 1:26
        ind = strfind(coded_text, decoder{jj});
        decoded{ii}(ind) = truth{jj};
    end
    
    % Display the message
    disp([num2str(ii) ' : ' decoded{ii}])
end

The truncated output looks like this:

1 : xibu jt uif obnf pg uif tztufn vtfe cz ibn pqfsbupst up nblf gsff qipof dbmmt?
2 : what is the name of the system used by ham operators to make free phone calls?
3 : vgzs hr sgd mzld ne sgd rxrsdl trdc ax gzl nodqzsnqr sn lzjd eqdd ognmd bzkkr?
4 : ufyr gq rfc lykc md rfc qwqrck sqcb zw fyk mncpyrmpq rm kyic dpcc nfmlc ayjjq?
...

It continues for 26 shifts of the alphabet, but I’ve only shown 4 here for brevity’s sake. Of the 26 lines, you can see that 2 shifts completely decodes the message, while the others further jumble it.

I’ve only got the message from Chapter 1 in the code since I already posted about it. If you want to know the other messages, then go buy the book!

Advertisements