Condense the profile hashing code a bit.