0
$\begingroup$

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?

$\endgroup$
1
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.