What is a good hash function for small nonsingular matrices over a field $\mathbb{F}_p$ for $p$ prime? I'm looking for an integer function which is close to being injective (but not necessarily perfectly injective) and doesn't take too long to compute in Matlab.
Things I've tried include the trace, the 3 diagonal elements (this can be turned into an integer function $A \mapsto A_{11}+pA_{22}+p^2A_{33}+...$), 4 randomly chosen elements, and the 3 column sums. But all of these make my program take an unreasonably long time for groups of order more than a few thousand.
Many thanks for any help with this!