Method: Zstdlib.adler32

Defined in:
ext/zstdlib_c/ruby/zlib-3.3/zstdlib.c

.adler32(*args) ⇒ Object

call-seq: Zstdlib.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 "zstdlib"

data = "foo" puts "Adler32 checksum: #Zstdlib.adler32(data).to_s(16)" #=> Adler32 checksum: 2820145



480
481
482
483
484
# File 'ext/zstdlib_c/ruby/zlib-3.3/zstdlib.c', line 480

static VALUE
rb_zlib_adler32(int argc, VALUE *argv, VALUE klass)
{
    return do_checksum(argc, argv, adler32);
}