Add Query::getHash

Relates to #555