Skip to content

Instantly share code, notes, and snippets.

@grantmacken
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grantmacken/9577957 to your computer and use it in GitHub Desktop.
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
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, '+/', '-_')
@grantmacken
Copy link
Author

added a replace to remove equals = at end of string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment