Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
ANN: Crypt::ISAAC 0.9.1 released
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Kirk Haines  
View profile  
 More options Oct 13 2005, 11:31 am
Newsgroups: comp.lang.ruby
From: Kirk Haines <khai...@enigo.com>
Date: Fri, 14 Oct 2005 00:31:46 +0900
Local: Thurs, Oct 13 2005 11:31 am
Subject: ANN: Crypt::ISAAC 0.9.1 released
This release is primarily a reorganization of the old package.  It has a much
better installer, a basic unit test suite, better README and licensing info,
and a gem has been built for Crypt::ISAAC as well.  The only functionality
change is to add an option when creating a new generator that will force it
to try to use /dev/random to seed the generator, instead of /dev/urandom
(falling back to rand() if neither is available).  This is an experimental
feature -- seeding from /dev/random appears to be almost too slow to be
usable since so much entropy is needed, but to use it, create pass false when
creating the object, as follows:

prng = Crypt::ISAAC.new(false)

The code should run anywhere that Ruby does, though there will be support for
better seeding of the prng on Windows coming soon.

The package has been uploaded to Rubyforge:

http://rubyforge.org/project/crypt-isaac

Here is the README:

Crypt::ISAAC README
============

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.  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.

Ruby uses the Mersenne Twister as its PRNG, and while this the Twister is
a fast PRNG that produces highly random numbers, it is not strong for
cryptographic purposes, nor is it suitable when one needs multiple
independent streams of random numbers.  Crypt::ISAAC is suitable for either
purpose.

Requirements
------------

  * Ruby 1.8 (should also run on 1.6.x)

Install
-------

  If you have never installed Crypt::ISAAC, you may run the testsuite
  to confirm that it works with:

    # ruby setup.rb test

  If you already have a version of Crypt::ISAAC installed, but want to
  confirm this one before installing, run the test suite manually as
  follows:

    # ruby test/TC_ISAAC.rb local

  When you are ready to install Crypt::ISAAC, type:

    # ruby setup.rb install

  This one step will install Crypt::ISAAC in your Ruby SITELIB.  To test
  the library after installation:

    # ruby setup.rb test

Usage
-----

require 'crypt/ISAAC'

rng = Crypt::ISAAC.new

r1 = rng.rand() # returns a floating point between 0 and 1
r2 = rnd.rand(1000) # returns an integer between 0 and 999

rand() should work identically to the Kernel.rand().

Enjoy it.  Let me know if you find anything that can be improved or that
needs to be fixed.

License
-------

The Crypt::ISAAC library is licensed with an MIT style licence.
See the LICENSE file for details.  As for the ISAAC algorithm itself,
see:

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

Please let me know if you run into any problem, especially with the gem.  This
is the first gem that I have produced.

Kirk Haines
khai...@enigo.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Berger  
View profile  
 More options Oct 13 2005, 12:35 pm
Newsgroups: comp.lang.ruby
From: Daniel Berger <Daniel.Ber...@qwest.com>
Date: Fri, 14 Oct 2005 01:35:17 +0900
Local: Thurs, Oct 13 2005 12:35 pm
Subject: Re: ANN: Crypt::ISAAC 0.9.1 released

Ew.  I'd prefer it if everyone would use lowercase for all package files.
Between "win32ole" and "Win32API", I developed a bit of a complex about this.

Otherwise, cool. :)

Regards,

Dan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Berger  
View profile  
 More options Oct 13 2005, 12:50 pm
Newsgroups: comp.lang.ruby
From: Daniel Berger <Daniel.Ber...@qwest.com>
Date: Fri, 14 Oct 2005 01:50:05 +0900
Local: Thurs, Oct 13 2005 12:50 pm
Subject: Re: ANN: Crypt::ISAAC 0.9.1 released

Kirk Haines wrote:
> This release is primarily a reorganization of the old package.  It has a much
> better installer, a basic unit test suite, better README and licensing info,
> and a gem has been built for Crypt::ISAAC as well.  The only functionality
> change is to add an option when creating a new generator that will force it
> to try to use /dev/random to seed the generator, instead of /dev/urandom
> (falling back to rand() if neither is available).  This is an experimental
> feature -- seeding from /dev/random appears to be almost too slow to be
> usable since so much entropy is needed, but to use it, create pass false when
> creating the object, as follows:

> prng = Crypt::ISAAC.new(false)

I got some improvement when I replaced "read" with "sysread" in ISAAC.rb.
Here's a little benchmark script I wrote:

require "crypt/ISAAC"
require "benchmark"
include Benchmark

MAX = ARGV[0] || 100

bm do |x|
    x.report("rand"){
       MAX.times{ Crypt::ISAAC.new(true) }
    }

    x.report("/dev"){
       MAX.times{ Crypt::ISAAC.new(false) }
    }
end

Results:

# Using read
 >ruby bench_isaac.rb
       user     system      total        real
rand  6.290000   0.410000   6.700000 (  6.928163)
/dev  6.490000   9.640000  16.130000 ( 23.197032)

# Using sysread
 >ruby bench_isaac.rb
       user     system      total        real
rand  6.340000   0.550000   6.890000 (  7.148228)
/dev  6.560000   3.050000   9.610000 (  9.976435)

This was on a stock Sunblade 150 running Solaris 10.

Regards,

Dan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kirk Haines  
View profile  
 More options Oct 13 2005, 1:03 pm
Newsgroups: comp.lang.ruby
From: Kirk Haines <khai...@enigo.com>
Date: Fri, 14 Oct 2005 02:03:44 +0900
Local: Thurs, Oct 13 2005 1:03 pm
Subject: Re: ANN: Crypt::ISAAC 0.9.1 released
On Thursday 13 October 2005 10:50 am, Daniel Berger wrote:

> I got some improvement when I replaced "read" with "sysread" in ISAAC.rb.
> Here's a little benchmark script I wrote:

I'll make that change.

> bm do |x|
>     x.report("rand"){
>        MAX.times{ Crypt::ISAAC.new(true) }
>     }

>     x.report("/dev"){
>        MAX.times{ Crypt::ISAAC.new(false) }
>     }
> end

The default is true, which means to use the nonblocking entropy source
(/dev/urandom), and while false tells it to use /dev/random.  It only uses
rand() if it can't find the /dev/urandom (or /dev/random if told to use
that).  So your timings that you have labeled "rand" are using /dev/urandom,
and the one labeld "/dev" is using /dev/random.

> # Using read

>  >ruby bench_isaac.rb

>        user     system      total        real
> rand  6.290000   0.410000   6.700000 (  6.928163)
> /dev  6.490000   9.640000  16.130000 ( 23.197032)

> # Using sysread

>  >ruby bench_isaac.rb

>        user     system      total        real
> rand  6.340000   0.550000   6.890000 (  7.148228)
> /dev  6.560000   3.050000   9.610000 (  9.976435)

I'm surprised it was that fast, actually.  On my boxes, I had FAR less entropy
in /dev/random available to me.  I actually thought that something was wrong
with my code the first time I tested it, it was so slow.  :)

Thanks for the feedback,

Kirk Haines


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »