ANN: Crypt::ISAAC 0.9

Discussion in 'Ruby' started by Kirk Haines, Aug 16, 2004.

  1. Kirk Haines

    Kirk Haines Guest

    This is to announce the release of Crypt::ISAAC, a pure Ruby implementation
    of the ISAAC psuedo-random number generator. ISAAC is an algorithm for
    generating cryptographically secure psuedo-random numbers. This library has
    been part of the Iowa package for a couple of years. This version will
    become the canonical version, however.

    Crypt::ISAAC can be used to setup multiple independent streams of random
    numbers, and offers a simple interface identical to that of Kernel.rand():


    require 'crypt/isaac'

    rng1 = Crypt::ISAAC.new
    rng2 = Crypt::ISAAC.new

    ri1 = rng1.rand(1000000)
    ri2 = rng2.rand(1000000)
    rf1 = rng1.rand
    rf2 = rng2-rand

    puts "#{ri1} -- #{ri2}"
    puts "#{rf1} -- #{rf2}"


    I am releasing the library as version 0.9 just because while I have been
    using it for a couple of years, nobody else has ever looked at it, so there
    may well be some tweaks and nudges to bits of it before I call it 1.0.


    Kirk Haines
     
    Kirk Haines, Aug 16, 2004
    #1
    1. Advertising

  2. On Tue, Aug 17, 2004 at 03:25:56AM +0900, Kirk Haines wrote:
    > This is to announce the release of Crypt::ISAAC, a pure Ruby implementation
    > of the ISAAC psuedo-random number generator. ISAAC is an algorithm for
    > generating cryptographically secure psuedo-random numbers. This library has
    > been part of the Iowa package for a couple of years. This version will
    > become the canonical version, however.
    >
    > Crypt::ISAAC can be used to setup multiple independent streams of random
    > numbers, and offers a simple interface identical to that of Kernel.rand():


    I have just uploaded Crypt::ISAAC 0.9-1 to the preliminary Ruby Production
    Archive (RPA) repository (http://rubyforge.org/frs/?group_id=265).

    Installation/upgrade is achieved with

    $ rpa install crypt-isaac

    and happens atomically, as usual.

    === More information on RPA and rpa-base at
    http://rpa-base.rubyforge.org

    $ rpa query -x crypt-isaac
    Matching available ports:
    name: crypt-isaac
    version: 0.9-1
    classification: Top.Library
    requires:
    description: ISAAC is a cryptographically secure PRNG.

    ISAAC is a cryptographically secure PRNG for generating high quality random
    numbers. Detailed information about the algorithm can be found at:

    http://burtleburtle.net/bob/rand/isaac.html

    This is a pure Ruby implementation of the algorithm. It is reasonably
    fast for a pure Ruby implementation, but the speed really can not be
    compared to simply using Kernel.rand(). On an 800Mhz PIII computer
    running Ruby 1.8.2, and while the machine is also serving as general
    desktop, the library seems to consistently generate between 15000 and
    16000 random numbers per second.


    --
    Running Debian GNU/Linux Sid (unstable)
    batsman dot geo at yahoo dot com
     
    Mauricio Fernández, Aug 16, 2004
    #2
    1. Advertising

  3. Kirk Haines wrote:
    > This is to announce the release of Crypt::ISAAC, a pure Ruby implementation
    > of the ISAAC psuedo-random number generator. ISAAC is an algorithm for
    > generating cryptographically secure psuedo-random numbers. This library has
    > been part of the Iowa package for a couple of years. This version will
    > become the canonical version, however.
    >
    > Crypt::ISAAC can be used to setup multiple independent streams of random
    > numbers, and offers a simple interface identical to that of Kernel.rand():
    >
    >
    > require 'crypt/isaac'
    >
    > rng1 = Crypt::ISAAC.new
    > rng2 = Crypt::ISAAC.new
    >
    > ri1 = rng1.rand(1000000)
    > ri2 = rng2.rand(1000000)
    > rf1 = rng1.rand
    > rf2 = rng2-rand
    >
    > puts "#{ri1} -- #{ri2}"
    > puts "#{rf1} -- #{rf2}"
    >
    >
    > I am releasing the library as version 0.9 just because while I have been
    > using it for a couple of years, nobody else has ever looked at it, so there
    > may well be some tweaks and nudges to bits of it before I call it 1.0.


    Thanks for that, Kirk. But I think I will need repeatability (as with
    Kernel#srand), for use in simulations, and also speed. So I kludged up a
    extension at http://redshift.sourceforge.net/isaac. It's public domain,
    just like the original ISAAC.

    One difference: since I am interested in simulations, I followed
    Jenkins' advice and set the state vector length to 16 longs rather than
    256 (smaller, faster, less secure). In the next iteration, I will make
    this selectable from the API.

    It's not well tested, but usage is:


    [ruby/prj/isaac/ext/isaac] irb -r isaac.so
    irb(main):001:0> r = ISAAC.new
    => #<ISAAC:0x40208aa0>
    irb(main):002:0> r.srand [234,546,7868,98]
    => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    irb(main):003:0> r.rand32
    => 413434623
    irb(main):004:0> r.rand32
    => 1012446849
    irb(main):005:0> r.rand32
    => 3846288904

    The input (and output) of #srand is an array of up to 16 longs used to
    seed the generator.

    Also in the next version: float output, distributions as in the Rand.rb
    that someone pointed out, better namespace, etc.
     
    Joel VanderWerf, Aug 18, 2004
    #3
  4. Kirk Haines

    Bob Jenkins Guest

    Joel VanderWerf <> wrote in message news:<>...
    > Kirk Haines wrote:
    > > This is to announce the release of Crypt::ISAAC, a pure Ruby implementation
    > > of the ISAAC psuedo-random number generator. ISAAC is an algorithm for
    > > generating cryptographically secure psuedo-random numbers. This library has
    > > been part of the Iowa package for a couple of years. This version will
    > > become the canonical version, however.
    > >
    > > Crypt::ISAAC can be used to setup multiple independent streams of random
    > > numbers, and offers a simple interface identical to that of Kernel.rand():
    > >
    > >
    > > require 'crypt/isaac'
    > >
    > > rng1 = Crypt::ISAAC.new
    > > rng2 = Crypt::ISAAC.new
    > >
    > > ri1 = rng1.rand(1000000)
    > > ri2 = rng2.rand(1000000)
    > > rf1 = rng1.rand
    > > rf2 = rng2-rand
    > >
    > > puts "#{ri1} -- #{ri2}"
    > > puts "#{rf1} -- #{rf2}"
    > >
    > >
    > > I am releasing the library as version 0.9 just because while I have been
    > > using it for a couple of years, nobody else has ever looked at it, so there
    > > may well be some tweaks and nudges to bits of it before I call it 1.0.

    >
    > Thanks for that, Kirk. But I think I will need repeatability (as with
    > Kernel#srand), for use in simulations, and also speed. So I kludged up a
    > extension at http://redshift.sourceforge.net/isaac. It's public domain,
    > just like the original ISAAC.
    >
    > One difference: since I am interested in simulations, I followed
    > Jenkins' advice and set the state vector length to 16 longs rather than
    > 256 (smaller, faster, less secure). In the next iteration, I will make
    > this selectable from the API.
    >
    > It's not well tested, but usage is:
    >
    >
    > [ruby/prj/isaac/ext/isaac] irb -r isaac.so
    > irb(main):001:0> r = ISAAC.new
    > => #<ISAAC:0x40208aa0>
    > irb(main):002:0> r.srand [234,546,7868,98]
    > => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    > irb(main):003:0> r.rand32
    > => 413434623
    > irb(main):004:0> r.rand32
    > => 1012446849
    > irb(main):005:0> r.rand32


    > => 3846288904
    >
    > The input (and output) of #srand is an array of up to 16 longs used to
    > seed the generator.
    >
    > Also in the next version: float output, distributions as in the Rand.rb
    > that someone pointed out, better namespace, etc.


    Initialization is much faster with size 16 instead of 256, and it
    consumes less memory, and it is less secure, but the number of
    instructions to produce a value remains the same. If you're using
    millions of values, it's unclear that it's faster.
     
    Bob Jenkins, Aug 18, 2004
    #4
  5. Bob Jenkins wrote:
    > Initialization is much faster with size 16 instead of 256, and it
    > consumes less memory, and it is less secure, but the number of
    > instructions to produce a value remains the same. If you're using
    > millions of values, it's unclear that it's faster.


    Good point. The generation time appears to be linear in the size, so
    over the long term, there's probably no difference in speed, unless
    there are cache effects. Still, I think the 16 size is worthwhile as an
    option if you have lots of generators, some of which may only be used to
    produce a small sequence of numbers.
     
    Joel VanderWerf, Aug 19, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AdrianK
    Replies:
    0
    Views:
    1,549
    AdrianK
    Jul 9, 2003
  2. pw_ ^

    Isaac Cipher impl. in python

    pw_ ^, Oct 1, 2009, in forum: Python
    Replies:
    0
    Views:
    316
    pw_ ^
    Oct 1, 2009
  3. Kirk Haines

    ANN: Crypt::ISAAC 0.9.1 released

    Kirk Haines, Oct 13, 2005, in forum: Ruby
    Replies:
    3
    Views:
    151
    Kirk Haines
    Oct 13, 2005
  4. Cosmia Luna
    Replies:
    4
    Views:
    338
    Cosmia Luna
    Mar 11, 2012
  5. asg

    de-crypt... crypt

    asg, Dec 23, 2005, in forum: Perl Misc
    Replies:
    3
    Views:
    139
Loading...

Share This Page