Is there a way to hash a turing machine?
Sure.  Any Turing machine can be represented as a bit string (print out the description of the Turing machine).  Any bit string can be encoded as a natural number (prepend a 1 bit, and view it as a binary representation of a number).