@@ 64-69 (lines=6) @@ | ||
61 | */ |
|
62 | private function encodeHex($dec) { |
|
63 | $return = ""; |
|
64 | while (bccomp($dec, 0) == 1) { |
|
65 | $dv = (string) bcdiv($dec, "16", 0); |
|
66 | $rem = (integer) bcmod($dec, "16"); |
|
67 | $dec = $dv; |
|
68 | $return = $return . self::$hexchars[$rem]; |
|
69 | } |
|
70 | return strrev($return); |
|
71 | } |
|
72 | ||
@@ 119-124 (lines=6) @@ | ||
116 | ||
117 | $hex = self::decodeHex($hex); |
|
118 | $return = ""; |
|
119 | while (bccomp($hex, 0) == 1) { |
|
120 | $dv = (string) bcdiv($hex, "58", 0); |
|
121 | $rem = (integer) bcmod($hex, "58"); |
|
122 | $hex = $dv; |
|
123 | $return = $return . self::$base58chars[$rem]; |
|
124 | } |
|
125 | $return = strrev($return); |
|
126 | ||
127 | //leading zeros |