Some SNMP agents return mac addresses as hex encoded ascii.
e.g. '30:30:3a:31:37:3a:66:32:3a:39:62:3a:34:36:3a:30:65'
Each octet represents 4 bits of the mac address.
Some vendors may also encode the separators into the string.
Heres a function to convert these strings back into plain hex.
<?php
$hexStr = '30:30:3a:31:37:3a:66:32:3a:39:62:3a:34:36:3a:30:65';
echo(str_replace(':','',hexStr2Ascii($hexStr)));
function hexStr2Ascii($hexStr,$separator = ':'){
$hexStrArr = explode($separator,$hexStr);
$asciiOut = null;
foreach($hexStrArr as $octet){
$asciiOut .= chr(hexdec($octet));
}
return $asciiOut;
}
?>
Outputs: '0017f29b460e'