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
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
-
require ‘whirlpool’
-
-
#### Convenience methods:
-
-
# Returns the Whirlpool hash for "hello world", as raw data.
-
hash = Whirlpool.calc("hello world")
-
-
# Same, but returns the hash as a hexadecimal string.
-
hash = Whirlpool.calc_hex("hello world")
-
-
#### There’s also an object-oriented way, allowing you calculate the hash
-
#### by incrementally adding data. The example below has the same
-
#### effect as Whirlpool.calc("hello world"):
-
wp = Whirlpool.new
-
wp.add("hello ")
-
wp.add("world")
-
hash = wp.finalize # Returns the hash as raw data.
-
-
# After having called finalize, you must either reset the
-
# Whirlpool object, or create a new one, if you want to calculate
-
# a new hash:
-
wp.reset
-
wp.add("hello ")
-
wp.add("world")
-
hash = wp.finalize
