Class: Digest::CRC32

Inherits:
Class
  • Object
show all
Includes:
Instance
Defined in:
lib/crc32.rb

Instance Method Summary collapse

Constructor Details

#initializeCRC32

Returns a new instance of CRC32.



7
8
9
# File 'lib/crc32.rb', line 7

def initialize
  reset
end

Instance Method Details

#finishObject



19
20
21
# File 'lib/crc32.rb', line 19

def finish
  [@crc32].pack("N")
end

#resetObject



11
12
13
# File 'lib/crc32.rb', line 11

def reset
  @crc32 = 0
end

#update(str) ⇒ Object



15
16
17
# File 'lib/crc32.rb', line 15

def update(str)
  @crc32 = Zlib.crc32(str, @crc32)
end