Im working on debugging Hex, and ive been able to convert a file uploaded into hex completely, what im trying to do now is run through the hex code and find a pattern. Ive gotten it to work for 00 - 19 but im trying to get the 0a -1f to work too.. meaning 00-19 or 0a-1f
What im trying to do after i find the pattern in the hex is to break it into an array..
The pattern im looking of is ##,00,00,00,## ( 00,00,00,00 -> 1f,00,00,00,1f )
example would be 02,00,00,00,02 OR 02,00,00,0a OR 0a,00,00,00,0f
The # sign being 00 - 19 or 0a - 1f .. Really all i need to gather is the following array.. cause the numbers im looking for are under 30 decimal. or 1F hex
what i currently am using to get the first half is this:
Code: Select all
preg_match_all("/(\d{1,2}),00,00,00,(\d{1,2})/", $string, $hexFind);
$hexMatch = array('00' => '0',
'01' => '1',
'02' => '2',
'03' => '3',
'04' => '4',
'05' => '5',
'06' => '6',
'07' => '7',
'08' => '8',
'09' => '9',
'0A' => '10',
'0B' => '11',
'0C' => '12',
'0D' => '13',
'0E' => '14',
'0F' => '15',
'10' => '16',
'12' => '17',
'13' => '18',
'14' => '19',
'15' => '20',
'16' => '21',
'17' => '22',
'18' => '23',
'19' => '24',
'1A' => '25',
'1B' => '26',
'1C' => '27',
'1D' => '28',
'1E' => '29',
'1F' => '30'
);
for ($i = 0; $i < count($hexFind[1]); $i++){
if($hexMatch[$hexFind[1][$i]] != '' && $hexMatch[$hexFind[2][$i]] != ''){
$currenCol['X'] = $hexM[$hexFind[1][$i]];
$currenCol['Y'] = $hexM[$hexFind[2][$i]];
echo $currenCol['X'].','.$currenCol['Y'].'<br>';
$data[] = $currenCol['X'].','.$currenCol['Y'];
}
}Thanks ahead of time.
-Dave