code: public static long generate(long hash, 
                                final byte []buffer, 
                                final int offset, 
                                final int length)
    {
      final long m = 0xc6a4a7935bd1e995L;
      final int r = 47;
      
      hash ^= length * m;
      
      int len8 = length / 8;
      
      for (int i = 0; i < len8; i++) {
        final int index = i * 8 + offset;
        
        long k = ((buffer[index + 0] & 0xffL)
                 | ((buffer[index + 1] & 0xffL) << 8)
                 | ((buffer[index + 2] & 0xffL) << 16)
                 | ((buffer[index + 3] & 0xffL) << 24)
                 | ((buffer[index + 4] & 0xffL) << 32)
                 | ((buffer[index + 5] & 0xffL) << 40)
                 | ((buffer[index + 6] & 0xffL) << 48)
                 | ((buffer[index + 7] & 0xffL) << 56));
        
        k *= m;
        k ^= k >>> r;
        k *= m;
        hash ^= k;
        hash *= m;
      }
      
      final int off = offset + (length & ~0x7);
      
      switch (length % 8) {
      case 7: hash ^= (buffer[off + 6] & 0xffL) << 48;
      case 6: hash ^= (buffer[off + 5] & 0xffL) << 40;
      case 5: hash ^= (buffer[off + 4] & 0xffL) << 32;
      case 4: hash ^= (buffer[off + 3] & 0xffL) << 24;
      case 3: hash ^= (buffer[off + 2] & 0xffL) << 16;
      case 2: hash ^= (buffer[off + 1] & 0xffL) << 8;
      case 1: hash ^= (buffer[off + 0] & 0xffL);
              hash *= m;
      }
      
      hash ^= hash >>> r;
      hash *= m;
      hash ^= hash >>> r;
      
      return hash;
    }
docs: Calculates hash from a buffer