serialize before hasing