https://bugzilla.wikimedia.org/show_bug.cgi?id=73411
--- Comment #5 from Brad Jorsch <[email protected]> --- (In reply to Nathan Larson from comment #4) > I don't really mind bloating the API I do. Without a good reason, there's little point in returning data in two different formats when it can easily be converted client-side. > It sounds like there's a two-step process going on to arrive at the final > sha1: > > wfBaseConvert( sha1( $text ), 16, 36, 31 ); > wfBaseConvert( $revision->getSha1(), 36, 16, 40 ); > > What would be the parameters to wfBaseConvert if one wanted to do this in > one step? Thanks. I note that $revision->getSha1() is returning the value returned by the first line, so the above is more correctly stated as: $stored = wfBaseConvert( sha1( $text ), 16, 36, 31 ); $output = wfBaseConvert( $stored, 36, 16, 40 ); The two wfBaseConvert calls are undoing each other. The one-step process would be: $output = sha1( $text ); Or if you really want to use wfBaseConvert for some reason, $output = wfBaseConvert( sha1( $text ), 16, 16, 40 ); (it turns out that both wfBaseConvert() and sha1() output lowercase hexits, so we don't need to worry about even that potential difference). -- You are receiving this mail because: You are the assignee for the bug. You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
