jeudi 19 mars 2015

php and c 64 length hexadecimal combination generator



function everyCombination($array) {
$arrayCount = count($array);
$maxCombinations = pow($arrayCount, $arrayCount);
$returnArray = array();
$conversionArray = array();
foreach ($array as $key => $value) {
$conversionArray[base_convert($key, 10, $arrayCount)] = $value;
}
$start = 10000;
$end = 10005;
for ($i = $start; $i < $end; $i++) {
$combination = base_convert($i, 10, $arrayCount);
$combination = str_pad($combination, 64, "0", STR_PAD_LEFT);
$returnArray[] = strtr($combination, $conversionArray);
}
return $returnArray;
}

print_r(everyCombination(array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F')));


output


Array ( [0] => 0000000000000000000000000000000000000000000000000000000000002710 [1] => 0000000000000000000000000000000000000000000000000000000000002711 [2] => 0000000000000000000000000000000000000000000000000000000000002712 [3] => 0000000000000000000000000000000000000000000000000000000000002713 [4] => 0000000000000000000000000000000000000000000000000000000000002714 )


above php code generating combination of 64 length hexadecimal given start value and end value, but some value later it cannot generate combination


if


$start = 9919999999999999903; $end = 9919999999999999913; ---> means it provide


output --> Array ( )


what problem in this code and i need all possible 64 length hexadecimal combination from given start and end value


AND the same time i need this code in C program


any result thank to all




Aucun commentaire:

Enregistrer un commentaire