Use a Hash protocol with proper equality semantics

Stop using byte arrays and use a Hash protocol, implemented by ArrayBackedHash.