Options
All
  • Public
  • Public/Protected
  • All
Menu
deprecated

Hashing class to use before v1.3.7

Hierarchy

Index

Constructors

Methods

  • doubleHashing(n: number, hashA: number, hashB: number, size: number): number
  • Apply Double Hashing to produce a n-hash

    Parameters

    • n: number

      The indice of the hash function we want to produce

    • hashA: number

      The result of the first hash function applied to a value.

    • hashB: number

      The result of the second hash function applied to a value.

    • size: number

      The size of the datastructures associated to the hash context (ex: the size of a Bloom Filter)

    Returns number

    The result of hash_n applied to a value.

  • Generate a set of distinct indexes on interval [0, size) using the double hashing technique This function is the old method called by a lot of filters. To work in the current version, replace, the getIndexes function of the filters by this one

    author

    Arnaud Grall

    Parameters

    • element: <internal>.HashableInput

      The element to hash

    • size: number

      the range on which we can generate an index [0, size) = size

    • number: number

      The number of indexes desired

    • Optional seed: number

      The seed used

    Returns number[]

    A array of indexes

  • Generate N indexes on range [0, size) It uses the double hashing technique to generate the indexes. It hash twice the value only once before generating the indexes. Warning: you can have a lot of modulo collisions.

    Parameters

    • element: <internal>.HashableInput

      The element to hash

    • size: number

      The range on which we can generate the index, exclusive

    • hashCount: number

      The number of indexes we want

    • Optional seed: number

    Returns number[]

    An array of indexes on range [0, size)

  • Hash an item as an unsigned int

    author

    Arnaud Grall

    Parameters

    • elem: <internal>.HashableInput

      Element to hash

    • Optional seed: number

      The hash seed. If its is UINT32 make sure to set the length to 32

    Returns number

    The hash value as an unsigned int

  • Hash an item and return its number and HEX string representation

    author

    Arnaud Grall

    Parameters

    • elem: <internal>.HashableInput

      Element to hash

    • Optional seed: number

      The hash seed. If its is UINT32 make sure to set the length to 32

    Returns { int: number; string: string }

    The item hased as an int and a string

    • int: number
    • string: string
  • (64-bits only) Hash a value into two values (in hex or integer format)

    author

    Arnaud Grall & Thomas Minier

    Parameters

    Returns TwoHashes

    The results of the hash functions applied to the value (in hex or integer)

  • internal

    Hash an element of type HashableInput into {@link Number} Can be overrided as long as you return a value of type {@link Number} Don't forget to use the seed when hashing, otherwise if some kind of randomness is in the process you may have inconsistent behaviors between 2 runs.

    Parameters

    Returns number

    A 64bits floating point {@link Number}

Generated using TypeDoc