Optimization: How to make sure XOR is performed in chunks

It is customary to name mutating functions with a !, and normally also to put the mutated object first: so hamming!(x, b1, b2).

You can also make it faster by using broadcasting instead of map!:

hamming!(x, b1, b2) = (x .= b1 .⊻ b2; return count(x))

This is roughly as fast as the implementation that accesses the .chunks field.

Pros: simpler implementation that does not rely on internal fields and unexported undocumented functions.
Cons: needs input buffer.