PHP and JavaScript help required?

I have two functions. One is PHP and the other is JavaScript. They both should generate the same string if the input is the same.
E.g.
input = "qwerty123" output would = "7.1674618149499E+85"
input = "qwerty123" output would = "7.1674618149499E+85"
input = "asdfg321" output would = "3.872593418529023e+91"

The problem is that the JS and PHP functions are NOT generating the same string/salt for the same input.

The code is here: lemsn.freehostia.com/match_code.txt
The match test is here: lemsn.freehostia.com/match_test.php
 
Hey.

I think your issue might be your javascript port of the "strpos" PHP function. strpos in PHP returns the first occurance of a strong within a string... whereas it looks like your javascript port of the function uses lastIndexOf, which returns the last occurance of a character in a string.

If I were you, I'd run a few tests on that function to see if it returning the same values as its PHP equivalent.
 
Back
Top