equals()/hashCode() & tests for ByteArrays

equals/hashCode helper implementations to avoid materializing a full byte[].

Fixes #5420