$byte) { if ($k == 12 || $k == 13 || $k == 14 || $k == 15) { $byte = 0; } $nSignature = ((($nSignature << 1) | ($nSignature >> 31)) + $byte & 0xFFFFFFFF); } return swapEndianness(str_pad(dechex($nSignature), 8, 0, STR_PAD_LEFT)); } $filename = "D:\Diablo II\MODS\ironman-dev\save\Necro.d2s"; $fp = fopen($filename, "r+b"); fseek($fp, 12); // go to byte 12 fwrite($fp, pack('I', 0)); // clear the checksum field uInt32 $fileData = unpack('C*', file_get_contents($filename)); // open file and unpack var_dump(checksum($fileData)); fseek($fp, 12); // go to byte 12 fwrite($fp, pack('H8', checksum($fileData))); // write new checksum fclose($fp);