Re: Code golf challenge: XKCD 936 passwords

2013-10-09 Thread Roy Smith
In article , Nick Cash wrote: > >> # Python-2, sorry > >> import os > >> print list(set(open('/usr/share/dict/words')))[os.getpid():][:4] > > > So that steps by your pid? > > Not really. It seems to rely on list(set(...)) kinda randomizing order... > which is definitely not safe without hash

Re: Code golf challenge: XKCD 936 passwords

2013-10-09 Thread random832
On Tue, Oct 8, 2013, at 18:27, Rob Day wrote: > On 08/10/13 07:17, Chris Angelico wrote: > > Who's up for some fun? Implement an XKCD-936-compliant password > > generator in Python 3, in less code than this: > > > > print(*__import__("random").sample(open("/usr/share/dict/words").read().split("\n")

RE: Code golf challenge: XKCD 936 passwords

2013-10-09 Thread Nick Cash
>> # Python-2, sorry >> import os >> print list(set(open('/usr/share/dict/words')))[os.getpid():][:4] > So that steps by your pid? Not really. It seems to rely on list(set(...)) kinda randomizing order... which is definitely not safe without hash randomization. But this brings up an interest

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Steven D'Aprano
On Tue, 08 Oct 2013 23:27:51 +0100, Rob Day wrote: > print("imploring epsilon decamp graveyard's") # Chosen by fair random > sampling, guaranteed to be random > > Comments don't count as code, right? ;) "cat cat cat cat..." That's the trouble with random, you can never quite tell. -- Steven

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Roy Smith
In article , Chris Angelico wrote: > On Wed, Oct 9, 2013 at 12:38 PM, Roy Smith wrote: > > If you're willing to accept a sub-optimal random number generator: > > > > # Python-2, sorry > > import os > > print list(set(open('/usr/share/dict/words')))[os.getpid():][:4] > > So that steps by your p

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Chris Angelico
On Wed, Oct 9, 2013 at 12:38 PM, Roy Smith wrote: > If you're willing to accept a sub-optimal random number generator: > > # Python-2, sorry > import os > print list(set(open('/usr/share/dict/words')))[os.getpid():][:4] So that steps by your pid? That's going to drastically reduce the entropy in

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Roy Smith
On Monday, October 7, 2013 8:17:21 PM UTC-10, Chris Angelico wrote: > > print(*__import__("random").sample(open("/usr/share/dict/words").read().spli > > t("\n"),4)) In article <68365e43-498f-4ad2-bac3-6a0293815...@googlegroups.com>, sprucebond...@gmail.com wrote: > import random as r > print(*

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Rob Day
On 08/10/13 07:17, Chris Angelico wrote: Who's up for some fun? Implement an XKCD-936-compliant password generator in Python 3, in less code than this: print(*__import__("random").sample(open("/usr/share/dict/words").read().split("\n"),4)) print("imploring epsilon decamp graveyard's") # Chose

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Chris Angelico
On Wed, Oct 9, 2013 at 7:27 AM, wrote: > On Tuesday, October 8, 2013 5:47:56 AM UTC-10, rand...@fastmail.us wrote: >> Importing random as r doesn't actually save anything, since " as r" is >> the same five characters you saved from the one use of it. > > I realize, it just looks nicer than the or

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread sprucebondera
On Tuesday, October 8, 2013 5:47:56 AM UTC-10, rand...@fastmail.us wrote: > Importing random as r doesn't actually save anything, since " as r" is > the same five characters you saved from the one use of it. I realize, it just looks nicer than the original __import__, and since it doesn't add any

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Tobiah
On 10/07/2013 11:17 PM, Chris Angelico wrote: Who's up for some fun? Implement an XKCD-936-compliant password generator in Python 3, in less code than this: print(*__import__("random").sample(open("/usr/share/dict/words").read().split("\n"),4)) Second challenge: Use it for generating all your p

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Tobiah
On 10/08/2013 09:07 AM, Tim Chase wrote: On 2013-10-08 15:36, Denis McMahon wrote: On Tue, 08 Oct 2013 08:33:48 -0400, Roy Smith wrote: In the old days, it used to be /usr/dict/words. Port Python to v6, and save another 6 characters :-) Doesn't matter where it is, a link to it exists at "/w"

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Tim Chase
On 2013-10-08 17:17, Chris Angelico wrote: > Who's up for some fun? Implement an XKCD-936-compliant password > generator in Python 3, in less code than this: > > print(*__import__("random").sample(open("/usr/share/dict/words").read().split("\n"),4)) > > Second challenge: Use it for generating all

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Tim Chase
On 2013-10-08 15:36, Denis McMahon wrote: > On Tue, 08 Oct 2013 08:33:48 -0400, Roy Smith wrote: > > In the old days, it used to be /usr/dict/words. Port Python to > > v6, and save another 6 characters :-) > > Doesn't matter where it is, a link to it exists at "/w" now ;) You prodigal...wasting

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread random832
On Tue, Oct 8, 2013, at 2:45, sprucebond...@gmail.com wrote: > On Monday, October 7, 2013 8:17:21 PM UTC-10, Chris Angelico wrote: > > print(*__import__("random").sample(open("/usr/share/dict/words").read().split("\n"),4)) > > # 87 > > import random as r > print(*r.sample(open("/usr/share/dict/wo

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Denis McMahon
On Tue, 08 Oct 2013 08:33:48 -0400, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> On Tue, Oct 8, 2013 at 5:48 PM, wrote: >> > And if we were actually trying then that filename should just be >> > "/w". >> > Would get rid of another 19 chars. >> >> I'm working this on the assum

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Roy Smith
In article , Chris Angelico wrote: > On Tue, Oct 8, 2013 at 5:48 PM, wrote: > > And if we were actually trying then that filename should just be "/w". > > Would get rid of another 19 chars. > > I'm working this on the assumption that the dictionary file already > exists (that's where it is o

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Mark Lawrence
On 08/10/2013 07:48, sprucebond...@gmail.com wrote: On Monday, October 7, 2013 8:45:39 PM UTC-10, spruce...@gmail.com wrote: On Monday, October 7, 2013 8:17:21 PM UTC-10, Chris Angelico wrote: Who's up for some fun? Implement an XKCD-936-compliant password generator in Python 3, in less code t

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Chris Angelico
On Tue, Oct 8, 2013 at 6:02 PM, Steve Simmons wrote: > Typical MUD Master - making up rules as you go along :-) Totally. Under the auspices of Rule Zero: http://tvtropes.org/pmwiki/pmwiki.php/Main/RuleOfFun :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread Steve Simmons
Chris Angelico wrote: >On Tue, Oct 8, 2013 at 5:48 PM, wrote: >> And if we were actually trying then that filename should just be >"/w". Would get rid of another 19 chars. > >I'm working this on the assumption that the dictionary file already >exists (that's where it is on my Debian Linux system

Re: Code golf challenge: XKCD 936 passwords

2013-10-07 Thread Chris Angelico
On Tue, Oct 8, 2013 at 5:48 PM, wrote: > And if we were actually trying then that filename should just be "/w". Would > get rid of another 19 chars. I'm working this on the assumption that the dictionary file already exists (that's where it is on my Debian Linux systems, for instance) and shoul

Re: Code golf challenge: XKCD 936 passwords

2013-10-07 Thread sprucebondera
On Monday, October 7, 2013 8:45:39 PM UTC-10, spruce...@gmail.com wrote: > On Monday, October 7, 2013 8:17:21 PM UTC-10, Chris Angelico wrote: > > > Who's up for some fun? Implement an XKCD-936-compliant password > > > > > > generator in Python 3, in less code than this: > > > > > > > > >

Re: Code golf challenge: XKCD 936 passwords

2013-10-07 Thread sprucebondera
On Monday, October 7, 2013 8:17:21 PM UTC-10, Chris Angelico wrote: > Who's up for some fun? Implement an XKCD-936-compliant password > > generator in Python 3, in less code than this: > > > > print(*__import__("random").sample(open("/usr/share/dict/words").read().split("\n"),4)) > > > > Sec