Generate port numbers Set any integer range and then hash any given string to a number within your range. >>> import portgen >>> print portgen.generate('frank', 1024, 49151) 16428