class Digest::CRC32

Public Class Methods

new() click to toggle source
# File lib/gorge/digest/crc32.rb, line 3
def initialize
  reset
end

Public Instance Methods

<<(string)
Alias for: update
block_length() click to toggle source

Returns the block length of the Digest.

@return [Integer]

# File lib/gorge/digest/crc32.rb, line 10
def block_length
  1
end
digest_length() click to toggle source

Returns the length in bytes of the hash value of the Digest.

@return [Integer]

# File lib/gorge/digest/crc32.rb, line 17
def digest_length
  4
end
finish() click to toggle source

Returns the hash value of the Digest packed into a string.

@return [String]

# File lib/gorge/digest/crc32.rb, line 43
def finish
  [@crc32].pack("N")
end
reset() click to toggle source

Resets the Digest to its initial state, and returns the Digest modified.

@return [self]

# File lib/gorge/digest/crc32.rb, line 25
def reset
  @crc32 = 0
end
update(string) click to toggle source

Updates the Digest using the given string, and returns the Digest modified.

@return [self]

# File lib/gorge/digest/crc32.rb, line 33
def update(string)
  @crc32 = Zlib.crc32(string, @crc32)
  self
end
Also aliased as: <<