corley
06-16-2003, 04:24 AM
Right now I am in the process of writing a script that will convert a string into an XOR encryption. I am trying to convert it from a Javascript script I found and I am using PHP to do the conversion.
There is a Javascript tidbit that for some reason I am unable to duplicate, so I am wondering whats the difference between one version I can, and one I can't.
I am unable to successfully duplicate the resultant from the following in PHP:
var mult =parseInt(rand.charAt(sPos*2) + rand.charAt(sPos*3));
however, I am able to duplicate the following I believe:
var mult = parseInt(rand.charAt(sPos*2)) + parseInt(rand.charAt(sPos*3);
If it is relevant, the PHP code is:
$mult = substr($rand, $sPos*2, 1) + substr($rand, $sPos*3, 1);
The last two match up perfectly in all my tests, however.
So pretty much my question is, whats the difference? TIA.
There is a Javascript tidbit that for some reason I am unable to duplicate, so I am wondering whats the difference between one version I can, and one I can't.
I am unable to successfully duplicate the resultant from the following in PHP:
var mult =parseInt(rand.charAt(sPos*2) + rand.charAt(sPos*3));
however, I am able to duplicate the following I believe:
var mult = parseInt(rand.charAt(sPos*2)) + parseInt(rand.charAt(sPos*3);
If it is relevant, the PHP code is:
$mult = substr($rand, $sPos*2, 1) + substr($rand, $sPos*3, 1);
The last two match up perfectly in all my tests, however.
So pretty much my question is, whats the difference? TIA.