Turn gateways into hash