I'm converting a php code containing the following 2 functions:
I am currently concerned with php pack and unpack functions. Although I've got some rough understanding about what they are doing I am a bit worried if I understand them right and I've no test data to ensure I'll make a correct implementation. Can anyone help me to convert this code or basically, what I want is to get a correctly working implementation of php pack and upack functions with this exact format ("N" and "N*") in either vb.net or c#.
PHP Code:
/**
* Covert a string into longinteger
*
* @param string $data
* @return array
*/
function _str2long($data)
{
$n = strlen($data);
$tmp = unpack('N*', $data);
$data_long = array();
$j = 0;
foreach ($tmp as $value) $data_long[$j++] = $value;
return $data_long;
}
/**
* Convert a longinteger into a string
*
* @param int $l
* @return string
*/
function _long2str($l)
{
return pack('N', $l);
}