Refactor hash function selection

 - Add proper macro for hash function/states.
 - Decrease number of #if by hash function/state macros.