Generating Entropy. - Mozilla

This is a discussion on Generating Entropy. - Mozilla ; Hi all, I have a question regarding generating suficient entropy using XPCOM objects. First off is this possible at all? like using: ["@mozilla.org/security/ entropy;1"] And is there any documentation on this particular object? I cannot seem to locate any proper ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Generating Entropy.

  1. Generating Entropy.

    Hi all,

    I have a question regarding generating suficient entropy using XPCOM
    objects.

    First off is this possible at all? like using: ["@mozilla.org/security/
    entropy;1"] And is there any documentation on this particular object?
    I cannot seem to locate any proper documentation on it.

    If not, what is the best way to go about this and generate good
    entropy for seeding a password generator?

    Any help is welcomed.


    Cheers,


    /rvdh


  2. Re: Generating Entropy.

    I have this so far, which seem to produce a good set of random bytes:

    buffer = '';
    var PRNG = Components.classes['@mozilla.org/security/random-generator;
    1'];
    var rg = PRNG.getService(Components.interfaces.nsIRandomGen erator);
    randomBytes = rg.generateRandomBytes (32, buffer);

  3. Re: Generating Entropy.

    On Apr 8, 11:38*pm, Nils Maier wrote:
    > On 08.04.2009 16:46, 0x000000 wrote:
    >
    > > I have this so far, which seem to produce a good set of random bytes:

    >
    > > buffer = '';
    > > var PRNG = Components.classes['...@mozilla.org/security/random-generator;
    > > 1'];
    > > var rg = PRNG.getService(Components.interfaces.nsIRandomGen erator);
    > > randomBytes = rg.generateRandomBytes (32, buffer);

    >
    > You may want to ask the NSS folks on m.d.crypto if this will produce
    > "good" random numbers, as nsIRandomGenerator uses
    > PK11_GenerateRandom()[1] from NSS.
    > Seems to be seeded in XUL applications from mouse move events
    > (coordinates and time)[2], don't know if NSS itself uses other entropy
    > sources as well.
    >
    > [1]http://mxr.mozilla.org/seamonkey/source/security/manager/ssl/src/nsRa....
    > [2]http://mxr.mozilla.org/seamonkey/source/dom/src/base/nsGlobalWindow.c....


    Thanks Nils,

    I posted it in dev.crypto

+ Reply to Thread