Ruby Whirlpool library

Version 1.0.0 – July 21, 2006

This is a Ruby library which implements the Whirlpool hashing algorithm. The implementation is optimized in C.

More information about Whirlpool:

The C code is based on the sample implementation, as available on the mentioned website.

Download

Download source code

To install it, enter the following commands (as root):

tar xjvf whirlpool-ruby-1.0.0.tar.bz2
cd whirlpool-ruby-1.0.0
ruby extconf.rb
make
make install

You can also get the latest development version from the Subversion repository:

http://public.railsplugins.net/repos/whirlpool-ruby/trunk

License

The code is licensed under the new BSD license. Please read LICENSE.TXT in the source code.

Comments

Have comments? Please post them here.

Example

Ruby
  1. require ‘whirlpool’
  2.        
  3. #### Convenience methods:
  4.  
  5. # Returns the Whirlpool hash for "hello world", as raw data.
  6. hash = Whirlpool.calc("hello world")
  7.  
  8. # Same, but returns the hash as a hexadecimal string.
  9. hash = Whirlpool.calc_hex("hello world")
  10.  
  11. #### There’s also an object-oriented way, allowing you calculate the hash
  12. #### by incrementally adding data. The example below has the same
  13. #### effect as Whirlpool.calc("hello world"):
  14. wp = Whirlpool.new
  15. wp.add("hello ")
  16. wp.add("world")
  17. hash = wp.finalize      # Returns the hash as raw data.
  18.  
  19. # After having called finalize, you must either reset the
  20. # Whirlpool object, or create a new one, if you want to calculate
  21. # a new hash:
  22. wp.reset
  23. wp.add("hello ")
  24. wp.add("world")
  25. hash = wp.finalize