Decryption of an 8-bit code

I'm trying to crack a code that's concatenated ascii codes, encrypted by xor'ing each ascii code with an 8 bit key. Decoding it is apparently an xor operation, however I've hit a brick wall.
My algorithm is 1) create a decrypt code 2) xor each letter with code 3) translate back to a number 4) change number to letter 5) print out message
3,4, and 5 a straightforward, but I can't move past 1 and 2
My code so far is
encrypted = '11111111111111111011101111100000000100000000101000101000000001000100010111101001001010111010100011100101';
z = reshape(encrypted, length(encrypted)/8,8)
key = dec2bin(0:255,8)
Basically I'm going to use brute force to crack it, and split things off into groups of 8.
If anyone has any suggestions I would really appreciate it!
Thank you

1 comentario

Walter Roberson
Walter Roberson el 27 de Mzo. de 2013
You probably want
z = reshape(encrypted .', 8, length(encrypted)/8).' ;

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 27 de Mzo. de 2013

0 votos

You cannot reliably break xor codes using brute force. You cannot, for example, determine whether the original source was
IBM
or
HAL
(as in 2001's HAL 9000 computer)

Preguntada:

el 27 de Mzo. de 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by