title: Calculate CRC32 checksum with Objective-C
body: <p>I am trying to convert my Java code in Objective-C.</p>
  
  <p>Java code:</p>
  
  <pre><code>pDataResult = "105501005523069400E4100300000000000000000000000000000000"
  
  checksum.update(pDataResult, 0, 12);
  long checksumValue = checksum.getValue();
  </code></pre>
  
  <p>In Objective-C:</p>
  
  <pre><code>#include &lt;zlib.h&gt;;
  
  NSString *testString = @"105501005523069400E4100300000000000000000000000000000000";
  NSData *testData = [testString dataUsingEncoding: NSUTF8StringEncoding];
  Byte *testByte = (Byte *)[testData bytes];
  
  uLong crc2 = crc32(0L, Z_NULL, 0);
  long long result2 = crc32(crc2, &amp;testByte, 12);
  
  NSLog(@"file crc32 checksum %llu", result2)
  </code></pre>
  
  <p>In Java the checksumValue is equal to 4253726258 but in Objective-C it is 752296094.</p>
  
  <p>UPDATE</p>
  
  <p>I have tried with this version</p>
  
  <pre><code>    Byte * j=Byte * j= {0x10, 0x55, 0x01 ,0x00, 0x55 ,0x23, 0x06, 0x94,0x00 ,0xe4, 0x10, 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,‌​0x00};
      NSData *data2 = [[NSData alloc] initWithBytes:&amp;j length:sizeof(j)] ;
  
      uLong crc = crc32(0L, Z_NULL, 0);
      long long result = crc32(crc, &amp;j, 12);
      NSLog(@"file crc32 checksum %llu", result);
  </code></pre>
  
  <p>I have got that now</p>
  
  <p><strong>429518402</strong></p>