Class: LZMA::Utils::CRC32
- Inherits:
-
Struct
- Object
- Struct
- LZMA::Utils::CRC32
- Defined in:
- lib/extlzma2/utils.rb
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: #<<)
Constructor Details
#initialize(state = 0) ⇒ CRC32
Returns a new instance of CRC32.
22 23 24 25 |
# File 'lib/extlzma2/utils.rb', line 22 def initialize(state = 0) state = state.to_i super(state, state) end |
Instance Attribute Details
#init ⇒ Object
Returns the value of attribute init
21 22 23 |
# File 'lib/extlzma2/utils.rb', line 21 def init @init end |
#state ⇒ Object
Returns the value of attribute state
21 22 23 |
# File 'lib/extlzma2/utils.rb', line 21 def state @state end |
Instance Method Details
#digest ⇒ Object
43 44 45 |
# File 'lib/extlzma2/utils.rb', line 43 def digest [state].pack('N') end |
#finish ⇒ Object
34 35 36 |
# File 'lib/extlzma2/utils.rb', line 34 def finish self end |
#hexdigest ⇒ Object Also known as: to_s
47 48 49 |
# File 'lib/extlzma2/utils.rb', line 47 def hexdigest format('%08x', state) end |
#reset ⇒ Object
38 39 40 41 |
# File 'lib/extlzma2/utils.rb', line 38 def reset self.state = init self end |
#to_str ⇒ Object Also known as: inspect
53 54 55 |
# File 'lib/extlzma2/utils.rb', line 53 def to_str "CRC32 <#{hexdigest}>" end |