http://www.perlmonks.org?node_id=951297

To create a password a la xkcd:

perl -le '@w=<>;chomp@w;print join" ",map{$w[rand@w]}1..4'</usr/share/ +dict/words
But then I get bizarre combinations like "revolutionizer ananda Pleurobrachiidae squaller" - I don't care what xkcd says, I'm not remembering that one. :)

Update: Slightly better, though a bit nasty to whoever owns the domain...

perl -MLWP::Simple -lE '@w=get("http://jbauman.com/gsl.html")=~/^\d+\s ++\d+\s+([a-z]+)/xmsg;say join" ",map{$w[rand@w]}1..4'
which gets me, as an example, "rather weight decay punctual". Much easier to memorise. I think I might keep this one :-)

Replies are listed 'Best First'.
Re: xkcd-style password generation
by JavaFan (Canon) on Feb 01, 2012 at 22:36 UTC
    With a little adaption:
    perl -le '@w=grep{length()>5&&length()<8&&/^[a-z]+$/}<>;chomp@w;print +join" ",map{$w[rand@w]}1..4'</usr/share/dict/words
    Some samples:
    octyl forrad ruble smoked unlit stamp finish stumpy baring pattu helium place tiptop sundri alumni anilla dodge blout spurl fasher lownly setal untar nuchal
    There are 23560 entries in my /usr/share/dict/words that match, giving 308106701416960000 different potential pass phrases. If an attacker can test 1 billion pass phrases per second, it takes almost 10 years to check the entire key space.

    I consider that secure enough for my Perlmonks password.

      Hahaaaa... ++ just for saying "secure" and "Perlmonks password" in the same sentence with a straight face. :-P :-) Plaintext passwords? Hahaha... thanks for that :-)

        Plaintext passwords?

        Someone remind me again; why is it so hard to change that?


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        The start of some sanity?

      > I consider that secure enough for my Perlmonks password.

      perlmonk's password is restricted to 8 characters.

      Cheers Rolf

Re: xkcd-style password generation
by BrowserUk (Patriarch) on Feb 01, 2012 at 20:30 UTC
    I don't care what xkcd says, I'm not remembering that one. :)

    It might be worth the effort. I can't imagine anyone guessing or brute forcing that one :)


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

      Just think of a sea creature riding multiple dinosaurs, named Amanda, starting a revolution in the slums. Then apply the corrective tweaks to each element :)
Re: xkcd-style password generation
by tobyink (Canon) on Feb 02, 2012 at 15:07 UTC

      Randall Munroe is awesome! A Google search for the phrase "inspired by xkcd" returns over 50,000 hits (including mine).

Re: xkcd-style password generation
by ww (Archbishop) on Feb 02, 2012 at 13:12 UTC
    But just think how secure that would be if one used a comprehensive dictionary of non-words...
    which dictionary included numbers and symbols as legitimate chars in the aforesaid non-words
    and in another language, perhaps...

      But there is some problem with non-words ... but I just can't seem to remember ... quite what it is ... um ...


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?