Class: LZMA::Utils::CRC32
- Inherits:
-
Struct
- Object
- Struct
- LZMA::Utils::CRC32
- Defined in:
- lib/extlzma.rb
Overview
CRC32 を Digest のように生成できるようになります。
Instance Attribute Summary collapse
-
#init ⇒ Object
Returns the value of attribute init.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
- #digest ⇒ Object
- #finish ⇒ Object
- #hexdigest ⇒ Object (also: #to_s)
-
#initialize(state = 0) ⇒ CRC32
constructor
A new instance of CRC32.
- #reset ⇒ Object
- #to_str ⇒ Object (also: #inspect)
-
#update(data) ⇒ Object
(also: #<<)
call-seq: LZMA::Utils::CRC32#update(data) -> self.
Constructor Details
#initialize(state = 0) ⇒ CRC32
Returns a new instance of CRC32.
394 395 396 397 |
# File 'lib/extlzma.rb', line 394 def initialize(state = 0) state = state.to_i super(state, state) end |
Instance Attribute Details
#init ⇒ Object
Returns the value of attribute init
393 394 395 |
# File 'lib/extlzma.rb', line 393 def init @init end |
#state ⇒ Object
Returns the value of attribute state
393 394 395 |
# File 'lib/extlzma.rb', line 393 def state @state end |
Instance Method Details
#digest ⇒ Object
419 420 421 |
# File 'lib/extlzma.rb', line 419 def digest [state].pack("N") end |
#finish ⇒ Object
410 411 412 |
# File 'lib/extlzma.rb', line 410 def finish self end |
#hexdigest ⇒ Object Also known as: to_s
423 424 425 |
# File 'lib/extlzma.rb', line 423 def hexdigest "%08x" % state end |
#reset ⇒ Object
414 415 416 417 |
# File 'lib/extlzma.rb', line 414 def reset self.state = init self end |
#to_str ⇒ Object Also known as: inspect
429 430 431 |
# File 'lib/extlzma.rb', line 429 def to_str "CRC32 <#{hexdigest}>" end |