Method: Zlib.adler32
- Defined in:
- zlib.c
.adler32(*args) ⇒ Object
call-seq: Zlib.adler32(string, adler)
Calculates Adler-32 checksum for string, and returns updated value of adler. If string is omitted, it returns the Adler-32 initial value. If adler is omitted, it assumes that the initial value is given to adler. If string is an IO instance, reads from the IO until the IO returns nil and returns Adler-32 of all read data.
Example usage:
require "zlib"
data = "foo"
puts "Adler32 checksum: #{Zlib.adler32(data).to_s(16)}"
#=> Adler32 checksum: 2820145
466 467 468 469 470 |
# File 'zlib.c', line 466 static VALUE rb_zlib_adler32(int argc, VALUE *argv, VALUE klass) { return do_checksum(argc, argv, adler32); } |