[RFC] Support for /dev/urandom in kdelibs

Michael Buesch mbuesch at freenet.de
Thu Dec 30 10:14:01 GMT 2004


Hi Brad,

That's pointing into the right direction.

I designed a first class API to provide random data through QIODevice.
I'm not completely sure if QIODevice is the right choice. Maybe
QFile is even better. So currently the class is derived from QIODevice
but it's likely to change to QFile.

The goal of this is to provide a well known standard interface for
random data. Also note that I'm saying "random data" as a generic
term and not "random numbers" or "random strings" here. The long term
goal is to get the class working with QDataStream, so that it is
absolutely generic. It won't be easy to get it working as far as I can
see, yet. But maybe it's possible and worth the effort.

Example pseudo code for the class usage:

KEntropySource es(KEntropySource::source_auto);
es.open();
MyDataType t0;
/* The user has defined the >> operator for this data-type somewhere. */
int t1;
QDataStream stream(es);
stream >> t0;
stream >> t1;
es.close();


What do you think?
Is this usable, required?
What can be done better?


Quoting Brad Hards <bradh at frogmouth.net>:
> On Sun, 26 Dec 2004 23:49 pm, Michael Buesch wrote:
> > Is there a possibility to get support for a cryptographically strong
> > randomizer into the kdelibs for KDE-4?
> Do you really need it in KDE? If not, I'm hoping to provide QCA
> (as a dependency) for KDE-4, which has support for random
> numbers. At the moment, the API looks like the following. As
> someone else pointed out, there are reasons for wanting to
> have multiple sources of random numbers. It also occurs to me
> that we may not have a source of /dev/urandom type numbers
> on every platform that KDE supports.
[SNIP]

-- 
Regards Michael Buesch  [ http://www.tuxsoft.de.vu ]


-------------- next part --------------
A non-text attachment was scrubbed...
Name: kentropysource.h
Type: text/x-chdr
Size: 4990 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20041230/7aa74274/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20041230/7aa74274/attachment.sig>


More information about the kde-core-devel mailing list