Make hash utils more generic