Prob­lem

A com­mon secu­rity method used for online bank­ing is to ask the user for three ran­dom char­ac­ters from a pass­code. For exam­ple, if the pass­code was 531278, they may ask for the 2nd, 3rd, and 5th char­ac­ters; the expected reply would be: 317.

The text file, keylog.txt, con­tains fifty suc­cess­ful login attempts.

Given that the three char­ac­ters are always asked for in order, analyse the file so as to deter­mine the short­est pos­si­ble secret pass­code of unknown length.

Solu­tion

This prob­lem is actu­ally solved much eas­ier by hand with pen and paper, but regard­less here’s a F# solu­tion to the problem.

Share

Leave a Reply