Improved preferred encyrption algorithm logic

The previous logic was completely wrong if multiple algorithms got
the same number of votes because the sorting algorithm had no
knowledge of algorithm strength.