Sorts hash entries by keys. Strings and symbols are sorted in lexicographical order, and numbers in descending order.