News for hackers. Stuff that matters.
Re:Xkcd Password Generator by nikcub on Thursday August 11, 2011 @10:43AM (#2873071)
as a bash alias:

  word_pass() {
      cat /usr/share/dict/words | awk 'BEGIN{srand();}{print rand()"\t"$0}' | sort -k1 -n | cut -f2 | head -n 4 | tr "\\n" " " && echo 
  }
then:

  $ word_pass
  corticifugally tetraploidy democrat vibrionic
(if you notice how this works, you can see that it isn't super-efficient, but it works)
Re:Xkcd Password Generator by gjm11 on Thursday August 11, 2011 @01:06PM (#2873760)
DANGER: This gives no more entropy than what srand() uses, which (at least for GNU awk) is simply the current UNIX time, which (if we assume that when you generated the password is known to within one year) means only about 25 bits of entropy.
Re:Xkcd Password Generator by nikcub on Thursday August 11, 2011 @01:36PM (#2873874)
srand in awk is platform specific. on most recent is isn't a straight call to srand().

I have another version that I use that stuffs srand but in the end I figured srand from a 250k dictionary is still better than picking words out of your head from a ~1k dictionary

Re:Xkcd Password Generator by gjm11 on Thursday August 11, 2011 @03:48PM (#2874442)
I looked at the trunk code for gawk on Savannah when I wrote the above. It passes the output of time(0) straight into srand().

The size of the dictionary doesn't matter (given that it's more than about 70 words); the limiting factor is the entropy in the RNG seeding.

Re:Xkcd Password Generator by adr_ on Thursday August 11, 2011 @11:16AM (#2873212)
Using shuf, my favourite, rarely used gnu textutil.

    shuf /usr/share/dict/words|head -4|tr '\n' ' ';echo
Re:Xkcd Password Generator by nikcub on Thursday August 11, 2011 @11:17AM (#2873223)
ye it isn't on OS X

just the same, sort -R is GNU only and not POSIX