updated hash functions for transformations and partial perms

The internal representation of transformations and partial perms was
rearranged to fix bug #461 (in the GAP tracker),
this change moves the hash function from Orb into the library to avoid
dependency between Orb and the internal rep of transformations and
partial perms in GAP.