# Why is this implementation of the hash function bad?

I have a task of hashing DNA sequences. Let the DNA be long sequences of four amino acids, which we will denote by the letters $$A, T, G$$ and $$C$$.

My hash function $$h$$ take DNA as an input and return the sum of amino acid numbers by some large simple modulus as a hash, and then add it to a hash table with a public key. Why is this hashing implementation bad?

## 1 Answer

Because

1. two sequences with the same acids in different order (e.g. two acids switch places) will have the same hash code;

2. this will only produce numbers from 0 to your large simple modulus instead of all $$2^{32}$$ or $$2^{64}$$ possibilities.