Class Hashing

java.lang.Object
edu.berkeley.cs.jqf.fuzz.util.Hashing

public class Hashing extends Object
Utility class for computing bounded hash values.
Author:
Rohan Padhye
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    hash(long x, int bound)
    Returns a bounded hashed value with one input.
    static int
    hash1(long x, long y, int bound)
    Returns a bounded hashed value with two inputs.
    protected static int
    knuth(long x, int bound)
    Compute knuth's multiplicative hash.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • knuth

      protected static int knuth(long x, int bound)
      Compute knuth's multiplicative hash.

      Source: Donald Knuth's The Art of Computer Programming, Volume 3 (2nd edition), section 6.4, page 516.

      Parameters:
      x - the input value to hash
      bound - the upper bound
      Returns:
      the hash value
    • hash

      public static int hash(long x, int bound)
      Returns a bounded hashed value with one input.
      Parameters:
      x - the input to hash
      bound - the upper bound
      Returns:
      a pseudo-uniformly distributed value in [0, bound)
    • hash1

      public static int hash1(long x, long y, int bound)
      Returns a bounded hashed value with two inputs.
      Parameters:
      x - the first input to hash
      y - the second input to hash
      bound - the upper bound
      Returns:
      a pseudo-uniformly distributed value in [0, bound)