title: How should a crc32 be stored in MySQL?
body: <p>I'm creating a crc32 in PHP and need to store it in a field in a MySQL database. After reading about how there is a concern about the results on a 32-bit vs 64-bit machine, I'm wondering how this number should be stored. This is how I'm treating the crc32 in PHP to get the same result on either bitsize machine:</p>
  
  <pre><code>&lt;?php
  $checksum = crc32("The quick brown fox jumped over the lazy dog.");
  // On a 32-bit system it prints -2103228862 instead of
  // 2191738434 which is correct and what prints on a 64-bit system. 
  // See the php.net manual page on crc32 for more information about
  // 32-bit vs 64-bit.
  echo "checksum without printf formatting: " . $checksum . "\n";
  printf("%u\n", $checksum);
  $string = sprintf("%u", $checksum);
  echo $string . "\n";
  ?&gt;
  </code></pre>
  
  <p>Output (on a 64-bit machine is):</p>
  
  <pre><code>checksum without printf formatting: 2191738434
  2191738434
  2191738434
  </code></pre>
  
  <p>How should this number be stored on MySQL? Here are a few choices I've come up with so far:</p>
  
  <pre><code>`hash1` CHAR(10) NOT NULL ,
  `hash2` varchar(32) NOT NULL,
  `hash3` int unsigned NOT NULL,
  </code></pre>
  
  <p>It looks like I should go with:</p>
  
  <pre><code>`hash4` BIGINT UNSIGNED NOT NULL ,
  </code></pre>