I was thinking about a keyboard algorithm. I know about the difference-between-two-strings algorithm. It’s enough for most strings, but for password analysis, I don’t think it’s enough. I think there should be some algorithm, somewhere, that can give me a number based on how close two characters are to each other. The distance between to two keys. With these values, one could figure the complexity to type such a string with these characters. I know for every nth key, it becomes n more difficult.
Here’s an example. A and L. That should return 8. A and Q should return 1. How do you account for shift-ed characters and those that aren’t letters naturally? I think we do it as an extra-key-step. So, if you’re comparing, a to A, 2 is returned. Those two keys are shift+a, which is 2 keys.
There’s more to this than that too. I’d also like the algorithm to be keyboard neutral. That’s not the best way to say it. I want to have a keyboard for the USA and one for Japan. (Let’s assume they are different.) If it’s possible to do what’s above, it should be possible to span those across keyboard. I’m not sure how to count the difference in this case.
Another case might be to look at their ASCII differences. (Or unicode if you’re going that high, although I actually want the difference of keys between them.) The ASCII difference is not that useful though, since everykey in ASCII is very close.
$ to 7 is only 3, but 7 to $ is 4. The difference is the destentation. Because $ is a shift-key (shift+4), the value is distance of 4 rather than 3.
The next complication is keys in different rows and colunms. For instance, B and K. How do you compute the distance between those keys? I think that it is 3 keys away. (You start at B and move to HJK, finishing on K, counting K in the return.)
Any ideas?