I am getting
Warning: pack(): 1 arguments unused in
$vector = pack("H*",0x77,0x99);
$vector = pack("H*","4A","76"); // with quotes also give same warning
but if i use only one value there is no Warning
$vector = pack("H*",0x77);
Do anybody know about this warning ?
what value should i pass to pack . is it should be hex?
You should pass it hexadecimals in a string, like so:
$vector = pack("H*", "7799");
If you use 0x77
you already have a numeric value with the value 77h, i.e. the compiler will transform the value from hexadecimals to binary - there is no need to use pack
on it.
If you really want to use the 0x77,0x99
notation, then put the notation in quotes and use the following:
$hex="0x77,0x99";
preg_match_all("/0x([0-9A-F]{2})/i", $hex, $out);
$data = pack("H*", join($out[1]));