Amos Vryhof wrote: > Good Morning everyone, > .... > > def DecodePassword( strPass): > """Decode a filezilla password""" > strKey = "FILEZILLA1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ" > > nPassLen = len(strPass) / 3 > nOffset = nPassLen % len(strKey) > > strDecodedPass = "" > > for i in range(nPassLen): > c = int(strPass[i * 3:(i * 3) + 3]) > c2 = ord(strKey[(i + nOffset) % len(strKey)]) > c3 = chr((c ^ c2)) > > strDecodedPass += c3 > > return strDecodedPass > > ...and tried to convert it to PHP, but since I don't know Python and > there is no documentation in the script to say what it's doing, my > function doesn't spit out all of the right characters... (it does some > though?? maybe coincidence) > > function DecodePassword($strPass) { > $strKey = "FILEZILLA1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"; > > $nPassLen = strlen($strPass) / 3; > $nOffset = ($nPassLen % strlen($strKey)); > > $strDecodedPass = ""; > > $passPieces = str_split($strPass,3); > > foreach($passPieces as $passPiece) { > $c = intval($passPiece); > $c2 = ord($strKey[($i + $nOffset) % strlen($strKey)]); ^---- WHERE IS $i DEFINED? (hint: it's not :-) > $c3 = chr(($c ^ $c2)); > > $strDecodedPass .= $c3; > } > > return $strDecodedPass; > } > > I know I simplified quite a bit, but I might have done it wrong...I > tried to convert line-for line, but I'm not sure what the stuff on Lines > 10 to 13 do. (Lack of Perl knowledge) > > There are perl and Javascript functions to do the decoding at > http://filezilla.sourceforge.net/forum/viewtopic.php?t=170 > > I'm not looking for a major undertaking, just something to do the > conversion so I don't have to rebuild definitions for 200 and something > websites.... If I can get it working properly, I'll probably put a > version on my server so people can convert their files as well, as I can > see this being a major PITA. > > Thanks! > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php