Permutations of group by and projections (typically) have no impact on a result set (a binding does not have an order of variables), but a permutation of the order by clause changes the order of bindings.
Currently this query produces the following hash:
SELECT ?a COUNT(?b) FROM <http://dbpedia.org/sparql> FROM NAMED <urn:foo> { ?a ?b ?c } GROUP BY STR(?c) ?a ORDER BY DESC(?a) DESC(STR(?c)) LIMIT 10 OFFSET 2
Tjny8TXJKFa7hYkh6VBRiv_6S_tZn3Fm_vyP-JtwPFM/cm60CQ/AA/s/ReTPZw/MusTnQ/AA/AA/AQ/AA/ZjanBg3tcVCB7ffhA/AA/GrxMCookg6M/AA/AA/2+10
One of the members of AA/AA/AQ/AA is the lehmer code for permutation of the order by clause - it needs to be moved closer to the front.
(Another TODO is to write a documentation of the hashing itself)