aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php7
1 files changed, 2 insertions, 5 deletions
diff --git a/index.php b/index.php
index 884b2afd..acc3fe49 100644
--- a/index.php
+++ b/index.php
@@ -221,7 +221,7 @@ function nl2br_escaped($html)
221 return str_replace('>','&gt;',str_replace('<','&lt;',nl2br($html))); 221 return str_replace('>','&gt;',str_replace('<','&lt;',nl2br($html)));
222} 222}
223 223
224/* Returns the small hash of a string 224/* Returns the small hash of a string, using RFC 4648 base64url format
225 eg. smallHash('20111006_131924') --> yZH23w 225 eg. smallHash('20111006_131924') --> yZH23w
226 Small hashes: 226 Small hashes:
227 - are unique (well, as unique as crc32, at last) 227 - are unique (well, as unique as crc32, at last)
@@ -233,10 +233,7 @@ function nl2br_escaped($html)
233function smallHash($text) 233function smallHash($text)
234{ 234{
235 $t = rtrim(base64_encode(hash('crc32',$text,true)),'='); 235 $t = rtrim(base64_encode(hash('crc32',$text,true)),'=');
236 $t = str_replace('+','-',$t); // Get rid of characters which need encoding in URLs. 236 return strtr($t, '+/', '-_');
237 $t = str_replace('/','_',$t);
238 $t = str_replace('=','@',$t);
239 return $t;
240} 237}
241 238
242// In a string, converts urls to clickable links. 239// In a string, converts urls to clickable links.