How does (for example) generate the URL fragment hash


Has anyone identified the scripts or techniques used by (or other popular site) to generate what appears to be a unique hash value after the URL fragment?

Contrived example: #.lfr25xei4

They change with every page refresh (at least in my experience).

(I considered asking this on Stack Overflow but not sure it belongs there.)

Best Answer

  • I know it's been a few months since this question was posted, but I got interested in the same thing and here are my findings.

    The hash is generated client-side, in Javascript, and it's based on current timestamp. The code looks like this:

    hash = generateHash().substr(0, 9)
    generateHash = function() {
      return Math.floor(2147483648 * Math.random()).toString(36) + 
        Math.abs(Math.floor(2147483648 * Math.random()) ^ (0, getTimestamp)()).toString(36)
    getTimestamp = || function() {
      return +new Date

    (functions have been renamed for clarity)

  • Related Question