[PYTHON-CRYPTO] Random data API

Andrew Kuchling akuchlin at mems-exchange.org
Fri Sep 21 22:00:18 CEST 2001


On Fri, Sep 21, 2001 at 03:44:30AM -0700, Itamar S.-T. wrote:
>new() returns an object, which has at least single
>method, read(bytes). read() accepts one argument, an
>integer, and returns a string of this length. The
>object returned by new() may optionally have other
>methods as well.

What about tracking the entropy and only returning a certain number of
bytes.  read() could just start returning "" when it runs out, or it
could raise an exception.  Perhaps there should be multiple levels of
support; at the minimum level only available() and new() are
supported, and the object only supports read().  Higher levels could
then define additional methods for checking how many bytes are left.

--amk





More information about the python-crypto mailing list