Password hashing and sorting by trip cost