d2tools/checksum.php

14 lines
357 B
PHP

<?php
require_once './src/D2Functions.php';
$filename = "D:\Diablo II\MODS\ironman-dev\save\Barb.d2s";
$fp = fopen($filename, "rb+");
fseek($fp, 12);
fwrite($fp, pack('I', 0)); // produces 4 bytes
$fileData = unpack('C*', file_get_contents($filename));
fseek($fp, 12);
fwrite($fp, pack('H8', checksum($fileData)));
dump(checksum($fileData));
fclose($fp);