'Q' and 'J' bug
Opened this issue · 3 comments
Then encrypting text and in the text, letters 'Q' or 'J' is "meet" before 'K' and 'I' then in the decrypted text all 'K' and 'Q' are replaced to 'Q'. The same story with 'I' and 'J', they are replaced to 'J'.
But here are n problem then 'K' and 'I' appears earlier than 'Q' and 'J'.
That's because in default mode 'Q' is replaced with 'K' and 'J' with 'I'. So getIndex(letter)
returns same position for original and replacement letter. And then dynamically creating a bigrams lookup table first appeared letter is inserted in bigrams lookup table. And that bigram is never changed afterwards.
Fix: Is to populate bigram lookup table with 'K' and 'I' containing bigrams before dynamically populating them. That could be done by calling encrypt method with all possible bigrams containing 'K' and 'I'.
prepopulate(letter)
method id doing that.