amaru Posted July 5, 2011 Share Posted July 5, 2011 I use this function to encrypt passwords. I can't use md5 because i use the passwords in a sa-mp server. function cryptpw($password) { for($i=0; $i < strlen($password); $i++) { $temp = ord($password[$i]); $temp += (3^$i) * ($i % 15); if($temp > (0xff)) { $temp -= 256; } $password[$i] = chr($temp); } return $password; } It encrypts the password but it puts some signs at the end of it like '}' or '�'. How can i remove them? Quote Link to comment Share on other sites More sharing options...
TeNDoLLA Posted July 5, 2011 Share Posted July 5, 2011 Fix your character set. Quote Link to comment Share on other sites More sharing options...
amaru Posted July 5, 2011 Author Share Posted July 5, 2011 I know the bases of php. This function is took from a ucp. How can i do it? Quote Link to comment Share on other sites More sharing options...
TeNDoLLA Posted July 5, 2011 Share Posted July 5, 2011 Uhm.. ucp what? Quote Link to comment Share on other sites More sharing options...
amaru Posted July 5, 2011 Author Share Posted July 5, 2011 user control panel Quote Link to comment Share on other sites More sharing options...
TeNDoLLA Posted July 5, 2011 Share Posted July 5, 2011 Try this what is the output echo mb_convert_encoding($crypted_password, 'UTF-8'); Also what is sa-mp server? I still think this is a character encoding problem, either in your browser settings, php, or html. Or combination of these. Quote Link to comment Share on other sites More sharing options...
amaru Posted July 5, 2011 Author Share Posted July 5, 2011 The last character is "Â" Quote Link to comment Share on other sites More sharing options...
btherl Posted July 6, 2011 Share Posted July 6, 2011 It depends on what exactly you want, but you could try using base64_encode() on the result of your encryption. Also I might rethink your calculation for the value to add - for many values of $i it has little or no effect, and it is very predictable. Quote Link to comment Share on other sites More sharing options...
newb Posted July 6, 2011 Share Posted July 6, 2011 try the mb_convert_encoding function and post back let me know what happens Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.