]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/ApplicationUtils.php
Merge pull request #979 from ArthurHoaro/feature/assets-cache-version
[github/shaarli/Shaarli.git] / application / ApplicationUtils.php
index 123cc0b3e567ef531e4123dff6d31149d5f69ff5..5643f4a09706f2bb5b867153ee09c3c4974d77c3 100644 (file)
@@ -221,4 +221,19 @@ class ApplicationUtils
 
         return $errors;
     }
+
+    /**
+     * Returns a salted hash representing the current Shaarli version.
+     *
+     * Useful for assets browser cache.
+     *
+     * @param string $currentVersion of Shaarli
+     * @param string $salt           User personal salt, also used for the authentication
+     *
+     * @return string version hash
+     */
+    public static function getVersionHash($currentVersion, $salt)
+    {
+        return hash_hmac('sha256', $currentVersion, $salt);
+    }
 }