title: What does this bitwise expression do, and can it be reversed given the final value?
body: <p>I am trying to find a hex value that will produce a result of 419326735, given the code below.</p>
  <p>I know that a hex value of &quot;0x2cd79929&quot; produces a result of 697947948, although I am still trying to determine <em>how</em>.</p>
  <p>This (code below) is part of a function that validates a firmware image given a hex value in the header.</p>
  <p>I am relatively new to C, but have experience with C# and other OO languages, although I have no experience with bitwise operations.</p>
  <pre><code>#include &lt;stdio.h&gt;
  
  char *hex_string;
  unsigned int initial_val;
  unsigned int final_val;
  
  int main()
  {
      hex_string = &quot;0x2cd79929&quot;;
      
      sscanf(hex_string,&quot;%x&quot;,&amp;initial_val);
      
      final_val = initial_val &lt;&lt; 0x18 |
                  initial_val &gt;&gt; 0x18 |
                  initial_val &gt;&gt; 8 &amp; 0xff00 |
                  (initial_val &amp; 0xff00) &lt;&lt; 8;
                  
      initial_val = final_val;
      
      printf(&quot;value is %d&quot;,final_val);
      return 0;
  }
  </code></pre>