On Wed, Nov 11, 2009 at 7:28 AM, andrew mcelroy <[email protected]> wrote: > > > On Wed, Nov 11, 2009 at 5:46 AM, Chris McQuistion <[email protected]> > wrote: >> >> Anyone out there know how to change the following part of a PHP script so >> it is creating SHA base16 passwords, instead of SHA base64? >> Chris >> >> /** >> * Calculates SHA password. >> * >> * @access private >> * @return string SHA password >> */ >> function _CalculateShaPassword($password) >> { >> if (COMMON_DEBUG_MODE) >> self::Log(COMMON_DEBUG, "called", __METHOD__, __LINE__); >> return base64_encode(pack('H*', sha1($password))); >> } >> /** > > in this instance it looks like its just a normal sha1 password that is > being encoded into base64. > > If this is the case, just return something other than base64_encode. > > The ticket is making sure that anywhere in the program that expects base64 > data is made aware of the change you put in place. > > Andrew > >>
You might be able to convert the base of the number after it's created. There are a few functions in the comments for base_convert that were useful to me. http://us.php.net/manual/en/function.base-convert.php My use was a little bit different. I was converting a string of 1's and 0's to a relatively url-friendly base64 to store gamestate information for a battleship script. I used Michael Renner's function and added a dash and underscore to the end of $chars, since he was happy with only base62. :) If you can bear the sight of abused php, I used it here as big_base_convert(): http://nesman.afraid.org/battleship/gamestate.php~ HTH, YMMV --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "NLUG" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en -~----------~----~----~----~------~----~------~--~---
