So this started as an assignment but turned out to be quite fun by the end of it. We were asked to make a biometric identification system with Java using any biometric identifier. There was one restriction – no libraries were allowed. Out went OpenCV and pretty much anything that could be made to work reliably within the time-frame of a week.
My first thought was to make a voice identifier – a system in which the distinct features of someone’s voice would be saved in order to identify them uniquely. But that turned out to be far more time-consuming than I thought and involved libraries which I could not adopt. There wasn’t much time to write them myself. So after 3 days of struggling, I switched to keystroke dynamics.
What’s keystroke dynamics? It’s the official term for the unique way you type on a keyboard. Turns out that each of us use a keyboard differently – with more than just a change in overall speed. We spend different amounts of time pressing each key and moving onto another, have our own favourites among the Shift keys and have this unique patterns while moving from one key to another. I’m sure you’ve noticed these things. And these little things add up to a relatively strong set of features that can uniquely identify someone.
To make things more organized, let’s start with biometrics in general. A biometric identifier is a distinct, measurable characteristic that can be used to label and describe individuals. You’ve probably used the most popular one – that fingerprint scanner on your iPhone or Android. There are two main categories of biometric identifiers.
- Physiological – relating to your body
- Fingerprints, iris recognition, face recognition, DNA, hand geometry, body smell and more
- Behavioural – involving the way you behave
- Voice, typing rhythm, gait (basically the way you move)
Intro’s done. In our case, keystroke dynamics has the features I mentioned before, with some fancy technical terms for most of them. Here are some definitions to make our lives easier.
- Dwell time – the time a key is kept pressed down.
- Flight time – period between pressing times or releasing times of two keys. Sometimes measured as time between releasing one key and pressing another.
- Digraphs & trigraphs – pairs & trios of letters that frequently appear together. In English, these inclue th, sh, tr, wh for digraphs and nth, sch, scr, spl, spr, str, thr for trigraphs. More generally, these are known as n-graphs.
Take a moment to think about these, especially the flight times and n-graphs. You would realize how each of us have different latencies associated with each n-graph. I myself type (a,s) and (i,o) within 50 milli seconds.
The verification methodology of this prototype application is quite crude at the moment, as mentioned below.
I first let the user type an arbitrary text and measured the dwell times for each key in a conventional US keyboard – the time each letter in English alphabet is kept pressed down. For example, user X dwells on key “Q” for 120 ms. This is taken as the average of all dwell times of occurrences of “Q” in the text. Then when a user, say Y, tries to identify himself as X, Y’s dwell time of “Q” is measured and let’ say it turns out to be 90 ms. The system checks whether the time difference for “Q” is within a range of 20 ms – did Y type within a safe range of 100 to 140 ms? If not, the system counts that Y failed to pass “Q”. If 10 or more such failures occur, Y is identified to be different from X.
Obviously, this is a very rough and arbitrary measurement. Test it with your friends and you’ll realize that the dwell times are more common than expected. But it was considerably accurate, given that only one parameter was being used. This is more of a proof-of-concept (and a last-moment assignment submission) to be fair. The system is to be extended with flight times and n-graphs in the future. Maybe.
You can find the code in GitHub. Give it a test run, why don’tcha?
Or better yet, extend the feature set.