hash: simplify code and fix whitespacing

Make whitespacing more uniform to coding conventions and also simplify
some fubar if + xfree combinations by using free only.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>