Thread: Byte Decryption

  1. #1
    Registered User
    Join Date
    Aug 2006

    Byte Decryption

    Hi all!

    I am doing some packet decryption where the encryption method is unknown, so I just have the raw data.

    I thought that receiving and decrypting large files on the fly is rather performance heavy with the simplest method:

    	case 0xAC:
    		foo = 0x00;
    	case 0x35:
    		foo = 0x01;
    	case 0x97:
    		foo = 0x02;
    That will make a maximum of 256 comparisions for each byte. Imagine a standard 100Mbit/s network, that's a maximum of comparisions per second, but I only have a Hz processor. Hence the decryption lags behind the file sent.

    By comparing the encrypted and decrypted bytes as hex numbers and also as binary numbers, I couldn't find any scheme between them.

    Here's the first 10 bytes to visualize it.
    00 01 02 03 04 05 06 07 08 09 - decrypted
    AC 35 97 0E DA 43 E1 78 40 D9 - encrypted
    My goal is to make the decryption as fast as possible. Is there another way than finding similarities between bytes? What are possibilites to find similarities between bytes?

    And a secondary question: With gcc, will the executable go top->bottom in a switch-case query?

    TIA, Hawk

  2. #2
    Registered User
    Join Date
    Sep 2008
    Toronto, Canada
    Just make a transformation array and index into it. Array needs to have 256 elements.

    Are you sure the decryption is that simple? A simple substitution code?

  3. #3
    Registered User
    Join Date
    Aug 2006
    I just realized my own how dumb I was
    Thanks for your answer, of course I can just use an array, oh my god!

    Yes, as I wrote, it is just byte decryption.

  4. #4
    Registered User hellork's Avatar
    Join Date
    Nov 2010
    I imagine that a simple code breaker could also be written to attack substitution schemes like this with frequency analysis (LFQ). Then the most common letters can be printed out. A message like "hello world" would decode with LFQ to something like "htlla xorld" and then the user could tweak it from there by trying different letters. Granted we would need a much larger text sample than simply "hello world" for the code breaker to work...

    Letter frequency - Wikipedia, the free encyclopedia

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 15
    Last Post: 08-30-2010, 09:26 AM
  2. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  3. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  4. Need some help regarding data structures
    By Afrinux in forum C Programming
    Replies: 15
    Last Post: 01-28-2006, 05:19 AM
  5. error: identifier "byte" is undefined.
    By Hulag in forum C++ Programming
    Replies: 4
    Last Post: 12-10-2003, 05:46 PM