[ANN] Digest::CRC32 0.1.0

Hi,

I’m sure there is already code around for crc32 in Ruby but I couldn’t
find it when I needed it so here goes…

Note that is it named simply crc32 in RAA.

Regards,

Robert Feldt

Digest::CRC32

···

Package: Digest::CRC32
Description: C and pure Ruby implementation of crc32
Version: 0.1.0
Release date: 2003-02-07
Author: Robert Feldt feldt@ce.chalmers.se
Available from: www.ce.chalmers.se/~feldt/ruby/extensions/crc32/README.txt
Tarball:
www.ce.chalmers.se/~feldt/ruby/extensions/crc32/crc32-0.1.0.tar.gz

What is it?

Implementation of the crc32 hash algorithm as a Digest::Base digester.
There is both a C and a pure Ruby implementation. The former for speed
and the latter for portability. By default it will use the C
implementation.

Why?

To support “legacy” apps where crc32 is used instead of more modern
alternatives.

Installation?

  1. unpack tarball (if you haven’t already)
  2. ruby install.rb config
  3. ruby install.rb setup
  4. ruby install.rb install
  5. ruby test/test_crc32.rb (OPTIONAL)

Example of use?

require 'digest/crc32’
digester = Digest::CRC32.new
digester.update "A nice little string…"
p digester.hexdigest

Requirements?

ANSI C compiler and Ruby 1.8. Should probably work with 1.6.X Ruby also
but I haven’t tested it.

Test::Unit is needed to run unit tests (so it is optional).

Documentation?

Usage should be same as for the Digest classes in the std Ruby
distribution.

License and legal issues?

All files in this package are

Copyright © 2003 Robert Feldt feldt@ce.chalmers.se
All rights reserved.

and they are distributed under LGPL. See LICENSE for details.

Special things to note?

CRC32 should NEVER be used for cryptographic purposes. Use MD5 or
(preferably) SHA1 for that.

CRC32 (in C) is about 25% faster than MD5.
CRC32 in C is more than 1500 times faster than CRC32 in Ruby on large
strings. The latter is only included for use with small strings.

Plans for the future?

None.

Do you have comments or questions?

I’d appreciate if you drop me a note if you’re successfully using
Digest::CRC32. If there are some known users I’ll be more motivated to
packing up additions / new versions and post them to RAA.

Happy coding!

Robert Feldt feldt@ce.chalmers.se