mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-13 16:34:23 -05:00
PHP checksum working need to refactor and make more useful, easier to use, refactor lots of code
This commit is contained in:
@@ -87,10 +87,14 @@ function setBit(int $n, int $p, bool $b){
|
||||
function getBit(int $b, int $p){
|
||||
return intval(($b & (1 << $p)) !== 0);
|
||||
}
|
||||
|
||||
function checksum($fileData) {
|
||||
/**
|
||||
* Calculate D2S Checksum
|
||||
* @param $data
|
||||
* @return string
|
||||
*/
|
||||
function checksum($data) : string {
|
||||
$nSignature = 0;
|
||||
foreach($fileData as $byte){
|
||||
foreach($data as $byte){
|
||||
$nSignature = ((($nSignature << 1) | ($nSignature >> 31)) + $byte) & 0xFFFFFFFF;
|
||||
}
|
||||
return swapEndianness(dechex($nSignature));
|
||||
|
Reference in New Issue
Block a user