Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #43355

Re: performance of script to write very long lines of random chars

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <oscar.j.benjamin@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.031
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'output': 0.05; 'quiet': 0.09; 'subject:script': 0.09; 'cc:addr:python-list': 0.11; 'random': 0.14; 'benjamin': 0.16; 'cc:name:python list': 0.16; 'components.': 0.16; 'considers': 0.16; 'does,': 0.16; 'instead:': 0.16; 'realising': 0.16; 'storing': 0.16; 'subject:random': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'wrote:': 0.18; 'thu,': 0.19; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'bytes': 0.24; 'mathematical': 0.24; 'typical': 0.24; 'cc:2**0': 0.24; 'source': 0.25; 'header:In-Reply-To:1': 0.27; 'external': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; '+0100,': 0.31; 'continually': 0.31; "d'aprano": 0.31; 'lot.': 0.31; 'steven': 0.31; 'maintaining': 0.32; 'run': 0.32; 'running': 0.33; 'sources': 0.33; 'sense': 0.34; 'could': 0.34; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'accessible': 0.36; 'doing': 0.36; 'operating': 0.37; 'received:209': 0.37; 'machines': 0.38; 'generating': 0.39; 'moving': 0.39; 'called': 0.40; 'how': 0.40; 'even': 0.60; 'is.': 0.60; 'slowly': 0.60; 'numbers': 0.61; 'skip:n 10': 0.64; 'grab': 0.64; 'provide': 0.64; 'of:': 0.68; 'electrical': 0.74; 'special': 0.74; 'noise': 0.84; 'oscar': 0.84; 'subject:long': 0.84; 'thermal': 0.84; 'subject:very': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=wcd3DyGx6hnL6wkbiYFpjmFJqFWjC2SJAcjalR2+w5I=; b=g+dhYtkxDkc+5T11k695wOdq9VIgle9F3RkK3R96KVqYRp8Ufm2+MtiFPYezoBRPBj hyunAejCcqkVMT0jvgRgb7fQyh0nIjPS7++KPKgGpP7Qo5m5T8FP9HZqrz1B441Zehb4 DpKu3fSFiIp8tHFJG8eAECOkZA2jRdpGNUFMKLgbVRxURlE8h7KA+h2aqPnDKr0Qn6NB teRr814eHzfzG57mwGdzvA0wV5vTPds8SKZMHrRCPyUbH9cmzKY9/KCh4FX/tZlKC5Wj i8AUF0WWletYHzOUF1hQ+ag+wwPXsjqAVKKNs+kz+6DVgGNL+GOWzRLGuZvJQ4XGvgq7 iU/A==
X-Received by 10.52.95.108 with SMTP id dj12mr793178vdb.46.1365681965393; Thu, 11 Apr 2013 05:06:05 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <51669576$0$29977$c3e8da3$5496439d@news.astraweb.com>
References <24dc619b-7abd-4be3-aa92-f858eb4ab85f@n4g2000yqj.googlegroups.com> <51666aae$0$29977$c3e8da3$5496439d@news.astraweb.com> <mailman.453.1365673692.3114.python-list@python.org> <51669576$0$29977$c3e8da3$5496439d@news.astraweb.com>
From Oscar Benjamin <oscar.j.benjamin@gmail.com>
Date Thu, 11 Apr 2013 13:05:45 +0100
Subject Re: performance of script to write very long lines of random chars
To "Steven D'Aprano" <steve+comp.lang.python@pearwood.info>
Content-Type text/plain; charset=ISO-8859-1
Cc Python List <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.463.1365681967.3114.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1365681967 news.xs4all.nl 2697 [2001:888:2000:d::a6]:54857
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:43355

Show key headers only | View raw


On 11 April 2013 11:50, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> On Thu, 11 Apr 2013 10:47:43 +0100, Oscar Benjamin wrote:
>
>> On 11 April 2013 08:47, Steven D'Aprano
>> <steve+comp.lang.python@pearwood.info> wrote:
>>
>>> One thing to be aware of: urandom may run out of entropy, and then it
>>> will slow down a lot. If you don't care about cryptographic randomness,
>>> you could use this instead:
>>
>> Reading this I'm realising that I don't really know what os.urandom is.
>> How exactly is it generating random numbers and what do you mean by it
>> running out of entropy?
>
> Some (most?) modern operating systems provide a cryptographically strong
> source of non-deterministic randomness. The non-deterministic part comes
> from external "stuff", which is called "entropy". Typical sources of
> entropy include network events, user key-presses, moving the mouse, and
> (presumably in machines with special hardware), even thermal noise in
> electrical components.

> Entropy is used and discarded, so urandom needs the OS to continually
> replenish the amount of entropy. Under normal circumstances, this it
> does, but if you grab lots of urandom output on a system which is
> otherwise quiet and not doing anything, it could run out.

Okay, so I understand what entropy is in the thermodynamic sense and
also in the mathematical (Shannon) sense but I'm still confused about
what it means that the OS is somehow storing entropy. Do you mean that
it is always maintaining a buffer of what it considers to be random
bytes that it slowly builds up from noise that is made accessible to
the OS from the hardware?


Oscar

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

performance of script to write very long lines of random chars gry <georgeryoung@gmail.com> - 2013-04-10 18:21 -0700
  Re: performance of script to write very long lines of random chars Chris Angelico <rosuav@gmail.com> - 2013-04-11 11:45 +1000
    Re: performance of script to write very long lines of random chars Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-11 05:33 +0000
      Re: performance of script to write very long lines of random chars Chris Angelico <rosuav@gmail.com> - 2013-04-11 15:53 +1000
  Re: performance of script to write very long lines of random chars Michael Torrie <torriem@gmail.com> - 2013-04-10 19:52 -0600
    Re: performance of script to write very long lines of random chars gry <georgeryoung@gmail.com> - 2013-04-10 19:40 -0700
      Re: performance of script to write very long lines of random chars Chris Angelico <rosuav@gmail.com> - 2013-04-11 13:14 +1000
  Re: performance of script to write very long lines of random chars MRAB <python@mrabarnett.plus.com> - 2013-04-11 04:09 +0100
  Re: performance of script to write very long lines of random chars Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-11 07:47 +0000
    Re: performance of script to write very long lines of random chars Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-04-11 10:47 +0100
      Re: performance of script to write very long lines of random chars Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-11 10:50 +0000
        Re: performance of script to write very long lines of random chars Robert Kern <robert.kern@gmail.com> - 2013-04-11 16:49 +0530
        Re: performance of script to write very long lines of random chars Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-04-11 13:05 +0100
        Re: performance of script to write very long lines of random chars Robert Kern <robert.kern@gmail.com> - 2013-04-11 19:06 +0530
        Re: performance of script to write very long lines of random chars Chris Angelico <rosuav@gmail.com> - 2013-04-11 23:56 +1000
  Re: performance of script to write very long lines of random chars Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-04-11 10:47 +0100

csiph-web