Last active
August 29, 2015 13:57
-
-
Save grantmacken/9577957 to your computer and use it in GitHub Desktop.
Generate a base64 md5 hash from a URL, which can become a 'unique' URL safe resource or file name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
import module namespace util="http://exist-db.org/xquery/util"; | |
let $href := "${url}" | |
let $base64flag := true() | |
let $alogo := 'md5' | |
let $hash := replace(util:hash($href, $alogo, $base64flag), '(=+$)', '') | |
return | |
translate( $hash, '+/', '-_') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
added a replace to remove equals = at end of string