     constructor: ->
       @fheEngine      = new MockFheEngine()
       @indexGenerator = new RandomIndexGenerator()
+      @hashFunction   = HashFunction.MURMUR3_128
 
     mapToKeys: ({ metadata, documentKey }) ->
       metadataMap  = {}

define 'kryptnostic.search.metadata-mapper', [
  'require'
  'kryptnostic.hash-function'
  'kryptnostic.mock.fhe-engine'
  'kryptnostic.search.random-index-generator'
], (require) ->

  HashFunction         = require 'kryptnostic.hash-function'
  MockFheEngine        = require 'kryptnostic.mock.fhe-engine'
  RandomIndexGenerator = require 'kryptnostic.search.random-index-generator'

  MINIMUM_TOKEN_LENGTH = 1

  #
  # compute size of largest metadata bucket for padding.

        if token.length <= MINIMUM_TOKEN_LENGTH
          continue

        # token -> 128 bit hex -> Uint8Array
        tokenHex  = @hashFunction(token)
        tokenUint = BinaryUtils.hexToUint(tokenHex)

        # compute address of token
        indexUint   = @fheEngine.getTokenAddress(tokenUint, documentKey)
        indexString = BinaryUtils.uint8ToString(indexUint)

        # pad occurence locations
        paddedLocations = @subListAndPad(locations, bucketLength)

        balancedMetadatum = { id, token, locations : paddedLocations }

        if metadataMap[indexString]
          metadataMap[indexString].push(balancedMetadatum)
        else
          metadataMap[indexString] = [ balancedMetadatum ]

      return metadataMap

