I don't know of any already available HashFunction
that'll do what you want, but it should be pretty easy to write it yourself. Something like:
public final class ByteArrayHashFunction extends AbstractStreamingHashFunction {
@Override
public Hasher newHasher() {
return new ByteArrayHasher();
}
@Override
public int bits() {
return 32;
}
private static final class ByteArrayHasher extends AbstractByteHasher {
private int hash = 1;
@Override
protected void update(byte b) {
hash = 31 * hash + b;
}
@Override
public HashCode hash() {
return HashCode.fromInt(hash);
}
}
}
You would need to copy a few of the abstract classes from common.hash
into your own package though.