aboutsummaryrefslogtreecommitdiff
path: root/public/install.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-11-10 22:45:58 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-11-10 22:45:58 +0100
commit76a027c9bbfc646c9690f00d63be49cc4287b9c3 (patch)
treebb3df87fe9d02bb9bde9b221d57a1c10bb13eada /public/install.php
parent3bd4e808789b53ed6b338f4dbe42494b00ae1251 (diff)
Amélioration des performances de small_hash
Diffstat (limited to 'public/install.php')
-rw-r--r--public/install.php7
1 files changed, 2 insertions, 5 deletions
diff --git a/public/install.php b/public/install.php
index 5b0618c37..0c39a031e 100644
--- a/public/install.php
+++ b/public/install.php
@@ -66,13 +66,10 @@ function writeArray ($f, $array) {
}
}
+// tiré de Shaarli de Seb Sauvage //Format RFC 4648 base64url
function small_hash ($txt) {
$t = rtrim (base64_encode (hash ('crc32', $txt, true)), '=');
- $t = str_replace ('+', '-', $t); // Get rid of characters which need encoding in URLs.
- $t = str_replace ('/', '_', $t);
- $t = str_replace ('=', '@', $t);
-
- return $t;
+ return strtr ($t, '+/', '-_');
}
// gestion internationalisation