Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.034 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'remaining': 0.07; 'bits': 0.09; 'received:internal': 0.09; 'python': 0.11; 'random': 0.14; 'less,': 0.16; 'letters.': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'set,': 0.16; 'set:': 0.16; 'wrote:': 0.18; '(but': 0.19; 'subject:Code': 0.24; 'this:': 0.26; 'least': 0.26; 'header:In- Reply-To:1': 0.27; 'to:2**1': 0.27; 'chris': 0.29; 'words': 0.29; 'mix': 0.30; 'code': 0.31; 'spirit': 0.31; 'received:66': 0.35; "who's": 0.35; 'words,': 0.36; 'level': 0.37; 'received:10': 0.37; 'implement': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:x 10': 0.40; 'improved': 0.60; 'letters': 0.60; 'from:no real name:2**0': 0.61; 'world.': 0.61; 'strictly': 0.61; 'further': 0.61; 'first': 0.61; 'header:Message- Id:1': 0.63; 'exceed': 0.68; 'fun?': 0.68; 'guaranteed': 0.75; 'day': 0.76; 'skip:p 80': 0.84; '2013,': 0.91 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:from:to:mime-version:content-transfer-encoding :content-type:subject:date:in-reply-to:references; s=mesmtp; bh= vrnICXBIYEegpoquN9VT37Wqcmk=; b=eLRG0JSKqMH5PERfe2CHSuVg25rhJuva lyhEbpVRW8te5jcpzk/XDq7Y/jQ4t6ZC3G+vwxfZto+zZ1JQgNZU4DEkdzPMziVk Sl2Vfm6/2bg+kWeoRw82kC+QdIV+8NDXDKYYwVsw/ZnQ3RvbY0xERYOURZHU4+VO Q76FT/jPpLw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:mime-version :content-transfer-encoding:content-type:subject:date:in-reply-to :references; s=smtpout; bh=vrnICXBIYEegpoquN9VT37Wqcmk=; b=pqdQ2 W+M7NuOCGBybkreb1br3NkUYLeBie3P8OCoA9xo0k2pVFwk36kOhq1SuWhEPtlAd mnpsJR0A5a+L+jeArFCOH1mQfM5wsIx6GbiuYP4K3/IUaIoFR8HGbAug7U3iOu72 beVemNqTbs7wS0lBRIGOID69/jupyWeYHAaHvs= X-Sasl-Enc: Y+XJEE4tuPHk8+RsLOwVBa1xsvS+Wl1u27Qv38o7yaND 1381350151 From: random832@fastmail.us To: Rob Day , python-list@python.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-ce174988 Subject: Re: Code golf challenge: XKCD 936 passwords Date: Wed, 09 Oct 2013 16:22:31 -0400 In-Reply-To: <525486E7.6040909@rkd.me.uk> References: <525486E7.6040909@rkd.me.uk> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1381350165 news.xs4all.nl 15960 [2001:888:2000:d::a6]:44528 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:56515 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"),4)) > > > > > print("imploring epsilon decamp graveyard's") > # Chosen by fair random sampling, guaranteed to be random Of course, the choice of dictionary makes all the difference in the world. print('kayo wide sitz keen') # Chosen by fair random sampling among SOWPODS words of four or fewer letters. # This is a set of 6870 words, XKCD Std. #936 requires a set of at least 2048. # This password's 50.98 bits of entropy exceed the standard's recommendations by 6.98. This can be further improved to the standard's recommended entropy level (but not strictly the same method) by selecting only the first one from this set, and selecting the remaining four words from the set of 1416 words of 3 letters or less, for 44.14 bits of entropy: print('axis ar cha tam') Or, keeping with the spirit of the standard, mix the set of 1416 words 3 letters or less with 632 randomly selected words from the four-letter set: print('pal alp govs deb')