In Building a Better LK Hash I developed a significantly improved variant of the Laine-Karras hash, for base-2 Owen scrambling. And in Owen Scrambling Based Blue-Noise Dithered Sampling I used base-4 Owen scrambling to build a simpler implementation of Ahmed and Wonka's screen-space blue-noise sampler. But there's an annoying gap between those two posts: unlike base-2, there's no fast hash for performing base-4 Owen scrambling, so you have to resort to a slower implementation.
In this post I'm going to fill that gap by developing a Laine-Karras style hash for base-4 Owen scrambling as well.1
Here's the hash we're going to end up with:
n ^= x * 0x3d20adea n ^= (n >> 1) & (n << 1) & 0x55555555 n += seed n *= (seed >> 16) | 1 n ^= (n >> 1) & (n << 1) & 0x55555555 n ^= n * 0x05526c56 n ^= n * 0x53a22864