Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed6.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; ':-)': 0.06; 'though.': 0.07; 'base64': 0.09; 'filename': 0.09; 'pm,': 0.10; 'output': 0.11; 'wrote:': 0.14; 'filenames': 0.16; 'fname': 0.16; 'simplest': 0.16; 'slashes': 0.16; 'subject:security': 0.16; 'argument': 0.16; 'tue,': 0.17; 'must.': 0.19; 'guess': 0.19; 'writes:': 0.19; 'header:In-Reply-To:1': 0.21; 'stuff': 0.22; 'received:209.85.161.46': 0.23; 'received:mail- fx0-f46.google.com': 0.23; 'skip:b 20': 0.23; "doesn't": 0.25; 'specify': 0.25; 'junk': 0.26; 'received:209.85.161': 0.26; 'message-id:@mail.gmail.com': 0.28; 'paul': 0.28; 'random': 0.28; 'subject:How': 0.30; 'adds': 0.32; 'to:addr:python-list': 0.33; 'that,': 0.34; 'received:google.com': 0.37; 'received:209.85': 0.37; 'problem.': 0.38; 'subject:: ': 0.38; 'should': 0.39; 'unless': 0.39; 'received:209': 0.39; 'it!': 0.39; 'to:addr:python.org': 0.39; 'custom': 0.60; 'more': 0.60; 'subject:good': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=4zqAZOJDkn2tGxku//0EMr538a4quw37Mb1efmgBYRY=; b=qZ7FDEYO2MHmpmkHXAvqRYu7JhjZXvLX35nWeLvYei8cmIzG7GgvFm9lW36EUBN3Fa ldhVKlPDObpHWLCDWowjkYurY3GGaobAIIDIHtSP0fKt/i4s6T7vABOu9ngzZdgF2fBJ UhNJMKseUW0oilfgX+urgVXmF5L5G251eMULg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=Zw4Y6/rk+U0xuU05ZeqyHLOK00onQ1bIO9w9eTmrtIzAOlFvUJtGCk7SsafaER5stN 60t0cRoqOLRLqYp8BVpPLCKAE6zp6UNJJV5W3IQrbCWdFMN2MpKEM5lQrpBwNnzldg43 x/UMxARXn5s4ZtRSQ35W/9zbnuiAh9RbGtvWk= MIME-Version: 1.0 In-Reply-To: <7xfwnl1ihk.fsf@ruckus.brouhaha.com> References: <4DEDFAEB.4050006@chamonix.reportlab.co.uk> <7xfwnl1ihk.fsf@ruckus.brouhaha.com> From: Ian Kelly Date: Tue, 7 Jun 2011 14:58:50 -0600 Subject: Re: How good is security via hashing To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 18 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1307480390 news.xs4all.nl 49047 [::ffff:82.94.164.166]:43707 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7186 On Tue, Jun 7, 2011 at 2:42 PM, Paul Rubin wrote: > geremy condra writes: >> # adds random junk to the filename- should make it hard to guess >> rrr =3D os.urandom(16) >> fname +=3D base64.b64encode(rrr) > > Don't use b64 output in a filename -- it can have slashes in it! =A0:-( > > Simplest is to use old fashioned hexadeimal for stuff like that, unless > the number of chars is a significant problem. =A0Go for a more complicate= d > encoding if you must. You can use base64.urlsafe_b64encode, or specify a custom altchars argument that doesn't include '/'. Definitely don't use base64 filenames on a case-insensitive filesystem, though. :-)