mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
New packets, general Improvement
This commit is contained in:
parent
9c4abf49f5
commit
5425dfa5dc
7 changed files with 28 additions and 72 deletions
|
|
@ -131,6 +131,17 @@ class Utils{
|
|||
|
||||
return ($negative === true ? "-":"").str_replace("x", "", $hash);
|
||||
}
|
||||
|
||||
public static function hexdump($bin){
|
||||
$output = "";
|
||||
$bin = str_split($bin, 16);
|
||||
foreach($bin as $counter => $line){
|
||||
$hex = chunk_split(chunk_split(str_pad(bin2hex($line), 32, " ", STR_PAD_RIGHT), 2, " "), 24, " ");
|
||||
$ascii = preg_replace('#([^\x20-\x7E])#', '.', $line);
|
||||
$output .= str_pad(dechex($counter << 4), 4, "0", STR_PAD_LEFT). " " . $hex . " " . $ascii . PHP_EOL;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
public static function microtime(){
|
||||
return microtime(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue