Decryption of an 8-bit code

조회 수: 4 (최근 30일)
Katherine Brideau
Katherine Brideau 2013년 3월 27일
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
Walter Roberson
Walter Roberson 2013년 3월 27일
You probably want
z = reshape(encrypted .', 8, length(encrypted)/8).' ;

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2013년 3월 27일
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)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by