hashing: port core hashing code from C to pure Julia.

This is in preparation for more drastic hashing changes, but this
change should have zero effect on behavior.