GuyBlade ([info]guyblade) wrote,

Password Quality

A while back, my old n900 was stolen, so I replaced it by getting a T-Mobile G2 phone. It is rather nice and so far I've been rather happy with it.

Like most Android phones, it allows the use of a 3 by 3 grid on which you can draw and connect symbols.

Someone else's phone showing the logon matrix:


This lets you pick any of the nine points as a start and then connect any number of points, no more than once each, to produce a sort of visual password.

Now, I was wondering this morning, while half awake, how many unique passwords this produces. The trick is that not all possible combinations are valid. For instance, if a password begins in the upper left hand corner, it cannot have the upper right hand corner as its next "digit". Instead, it must first pass through the upper center orb. With no more than 9 possible digits, it seemed like it would be easy to calculate the number of unique combinations recursively, so I did:


(define max-passwords
(lambda ()
(letrec
((in-list
(lambda (val lst)
(cond
((eq? lst '()) #f)
((eq? (car lst) val) #t)
(else (in-list val (cdr lst))))))
(ok-vals
(lambda (num)
(cond
((eq? num 1) (list 2 4 5 6 8))
((eq? num 2) (list 1 3 4 5 6 7 9))
((eq? num 3) (list 2 4 5 6 8))
((eq? num 4) (list 1 2 3 5 7 8 9))
((eq? num 5) (list 1 2 3 4 6 7 8 9))
((eq? num 6) (list 1 2 3 5 7 8 9))
((eq? num 7) (list 2 4 5 6 8))
((eq? num 8) (list 1 3 4 5 6 7 9))
((eq? num 9) (list 2 4 5 6 8)))))
(valid-sucs
(lambda (ok used)
(begin
;(display (reverse used))
;(newline)
(+ 1 (apply +
(map
(lambda (x)
(if (in-list x used) 0
(valid-sucs (ok-vals x) (cons x used))))
ok)))))))
(apply +
(map
(lambda (x)
(valid-sucs (ok-vals x) (list x)))
(list 1 2 3 4 5 6 7 8 9))))))



Turns out that if you run this, you end up with 140,249 unique passwords of any length (1 to 9 orbs).

I also calculated what it would be if you could go from (say) upper left to upper right without being forced to go through the center and found that it was 986,409 possible passwords of any length (1 to 9 orbs).

Published by XPostGTK+

  • Post a new comment

    Error

    Your IP address will be recorded 

  • 9 comments

[info]chrisjbaker

January 6 2011, 01:36:05 UTC 1 year ago

wow, that's awesome

tristan says you should post that on http://forum.xda-developers.com/

[info]feveredwritings

January 6 2011, 15:48:57 UTC 1 year ago

I wonder what the most common passwords are, and how often they appear compared to the average?

[info]locallunatic

January 7 2011, 00:33:32 UTC 1 year ago

No more than once each? Wonder why they didn't allow for ending a password at the starting mark as that would allow full shapes that (I'd think at least) would be more easily remembered.

[info]guyblade

January 7 2011, 00:47:41 UTC 1 year ago

It is a valid question. An interesting side effect is that it is difficult to create complex and symmetric shapes, which I find unfortunate. Most possible symmetric shapes are too simple to make decent passwords.

[info]locallunatic

January 7 2011, 02:08:06 UTC 1 year ago

How many are there that are symmetric? You could mod your algorithm so that it does a 2x3 with second column having to be the end point, can't be start, and no second to second (then double the result for vertically symmetric vs. horizontal) to find the number. It has to be pretty small.

[info]locallunatic

January 7 2011, 02:13:23 UTC 1 year ago

26. Just did in head faster than could adjust algorithm.

[info]locallunatic

January 7 2011, 02:17:21 UTC 1 year ago

No wait, 5 each for end top or bottom and 5 end middle so 30.

[info]locallunatic

January 7 2011, 02:24:27 UTC 1 year ago

Fuck dropping options all over the place. For ending top middle is 6 (top 1, middle 2, bottom 3), so bottom middle is 6, and end middle middle is still 5. So 34. Man I keep messing up, maybe adjusting would have been faster.

[info]locallunatic

January 7 2011, 02:27:28 UTC 1 year ago

Damn it off again, I give up.
Create an Account
Forgot your login or password?
Facebook Twitter More login options
English • Español • Deutsch • Русский…