|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-01-03 13:24 UTC] chris at acsi dot ca
[2006-01-04 10:20 UTC] mgf@php.net
[2006-01-04 16:31 UTC] chris at acsi dot ca
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 08:00:01 2025 UTC |
Description: ------------ base_convert($str, 10, 16) will not function properly with numbers greater than 13 characters. Reproduce code: --------------- -BEGIN SCRIPT- $string=(string)"Hello Kitty".(string)time(); $hash=md5($string); $hash=strtoupper($hash); // Easier to Read echo("<br>1Hash is '$hash'<br>"); settype($hash, "string"); echo("<br>2Hash is '$hash'<br>"); $hash=base_convert($hash, '16', '10'); // Flick the string from hex to dec echo("<br>3Hash is '$hash'<br>"); $hash=base_convert($hash, '10', '16'); $hash=strtoupper($hash); echo("<br>4Hash is '$hash'<br>"); // Flick the string back $hash=strtoupper($hash); // Easier to read echo("<br>5Hash is '$hash'<br>"); -END SCRIPT- Expected result: ---------------- I can't show the exact expected number, as my MS Calc in hex mode can't handle this number, but it's pretty obvious that all the trailing 0's are wrong. Actual result: -------------- Here is the output text: 1Hash is '9789A9C80C9BFB6B40AD83670F14D64A' 2Hash is '9789A9C80C9BFB6B40AD83670F14D64A' 3Hash is '201428215609899446868600620602402480202' 4Hash is '9789A9C80C9BF8000000000000000000' 5Hash is '9789A9C80C9BF8000000000000000000'