Thread: BYTES(More Info)

  1. #1
    Unregistered
    Guest

    BYTES(More Info)

    Ok,
    I will try and improve my query. I am trying to do an exhaustive search to find a key. That key is 32bits, but I have reduced this search by finding out which key bits are effective (ie: effecting the output).

    I have therefore eliminated the final byte and bit 7 from this exhaustive search, leaving me with 23 bits of possibilites for the remaining bits. 2^23 is much less than 2^32.

    I now need some way to cycle through the possibilities for the remaining 23 bits. At the moment I have split it into 4 bytes and set the last byte to 1 (it can be anything:it doesnt matter) and the same with bit 7.

    Now, here's an example:
    from left to right: bit0 -> bit31

    key={XXXXXXXX 00000000 00000000 X0000000}

    "bits set to X is a don't care"

    I need a way to get all possible values for the above key.

    eg: key={XXXXXXXX 00000000 00000000 X0000000}
    key={XXXXXXXX 00000000 00000000 X0000001}
    key={XXXXXXXX 00000000 00000000 X0000010}
    key={XXXXXXXX 00000000 00000000 X0000101}

    all the way to
    key={XXXXXXXX 11111111 11111111 X1111111}

    now if i try and go around a loop 2^32 and get all possible values I will never break out of it......
    thats why I have reduced the number of bits to 23....

    any ideas please

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > key={XXXXXXXX 00000000 00000000 X0000000}
    Code:
    long int x, y, key;
    for ( x = 0 ; x <= 0x00ffff00 ; x += 0x100 ) {
      for ( y = 0 ; y <= 0x7f ; y++ ) {
        key = x | y;
      }
    }

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Hey, Salem, long time no see.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help displaying info from structure
    By kisiellll in forum C Programming
    Replies: 6
    Last Post: 04-04-2009, 12:51 PM
  2. Question about getting an info class from another Form
    By Joelito in forum C# Programming
    Replies: 0
    Last Post: 10-16-2006, 01:02 PM
  3. Help doing an e-mail program in c...
    By Tyler_Durden in forum C Programming
    Replies: 88
    Last Post: 01-02-2005, 03:12 PM
  4. Binary trees search problem...
    By Umoniel in forum C Programming
    Replies: 2
    Last Post: 02-22-2004, 02:29 PM
  5. Replies: 3
    Last Post: 12-06-2001, 05:30 AM