Ask a Question related to PHP Development, Design and Development.
-
Kevin Torr #1
Dynamic population of multidimensional array?
Here is my goal:
I have a destructive encryption algorithm I designed. It's similar to MD5,
in that it can't be decrypted.
The way it works is it gets the ASCII number of what you input, and
truncates it down to 10 possible characters.
so out of the 94 visible characters (number 32 -> 126), it makes 10 possible
output characters per input character.
I'm working on a decryption algorithm, which basically grabs the encrypted
text, and spits out all the possible inputs that could get that result.
I'm estimating n^9.4 possible inputs (where 'n' = strlen($input)).
Okay, so here's how I figure I can do it.
Each character of $encrypted has 1 dimension in my array $decrypt
for example
$encrypted{0} == $decrypt[0]
$encrypted{1} == $decrypt[1]
there will be approx 9 possible decrypted characters per character frin
$encrpted
$decrypt[0][0] --> $decrypt[0][8]
These are the 9 possible original input characters that could have produced
$encrypted{0}
essentially, this is what I need to do:
$i = 0;
$decrypt = array(
while ($i < strlen($encrypted)) {
$i => array();
}
);
Then something like
$i = 0;
$iposs = 0
while ($i < count($est)) {
while ($iposs < 10) {
$tmp = ($encrypted{$i} + $iposs)
array_push($decrypt[$i], $tmp);
$iposs++;
}
$i = 0;
$iposs = 0;
while ($i < count($decr)) {
while ($iposs < count($decr[$i])) {
echo $decrypt[$i][$iposs];
$iposs++;
}
echo '<br>';
$i++;
}
Obviously this doesn't work, as I can't put a 'while' inside an 'array()'
function.
How do I dynamically populate a multidimensional array?
Alternatively:
$i = 0
while ($i < 10) {
$array$i = array();
$i++;
}
//create array0[], array1[], array2[], array3[] ---> array9[]
How do I do this? my code doesn't work for this either.
Thanks :)
Kevin Torr Guest
-
Dynamic form population
The addition of flash & XMl forms in CFMX7 is great. Just wondering if there is a way to dynamically populate a field based on another (i.e. from... -
dynamic list population
I am currently trying to set up a form which contains 2 list menus. The first menu is populated dynamically. The problem comes in with the second... -
Multidimensional array: see if 1st key is available
Hi, I've got an multidimensional array $ret = $country_code; Now I want to see if $countryCode is even in that array, because if it's not, it... -
Split multidimensional array into 4 multidimensional arrays
Hello everyone, I have a multidimensional array that I need to split into 4 multidimensional arrays. I've tried the examples from the... -
dynamic access to multidimensional array
Hi, Is it somehow possible to index an array by another array? Example: @AoA = ( , , , );



Reply With Quote

