Class: LZMA::Utils::CRC64
- Inherits:
-
Struct
- Object
- Struct
- LZMA::Utils::CRC64
- Defined in:
- lib/extlzma.rb
Overview
CRC64 を 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) ⇒ CRC64
constructor
A new instance of CRC64.
- #reset ⇒ Object
- #to_str ⇒ Object (also: #inspect)
-
#update(data) ⇒ Object
(also: #<<)
call-seq: LZMA::Utils::CRC64#update(data) -> self.
Constructor Details
#initialize(state = 0) ⇒ CRC64
Returns a new instance of CRC64.
440 441 442 443 |
# File 'lib/extlzma.rb', line 440 def initialize(state = 0) state = state.to_i super(state, state) end |
Instance Attribute Details
#init ⇒ Object
Returns the value of attribute init
439 440 441 |
# File 'lib/extlzma.rb', line 439 def init @init end |
#state ⇒ Object
Returns the value of attribute state
439 440 441 |
# File 'lib/extlzma.rb', line 439 def state @state end |
Instance Method Details
#digest ⇒ Object
465 466 467 |
# File 'lib/extlzma.rb', line 465 def digest [state].pack("Q>") end |
#finish ⇒ Object
456 457 458 |
# File 'lib/extlzma.rb', line 456 def finish self end |
#hexdigest ⇒ Object Also known as: to_s
469 470 471 |
# File 'lib/extlzma.rb', line 469 def hexdigest "%016x" % state end |
#reset ⇒ Object
460 461 462 463 |
# File 'lib/extlzma.rb', line 460 def reset self.state = init self end |
#to_str ⇒ Object Also known as: inspect
475 476 477 |
# File 'lib/extlzma.rb', line 475 def to_str "CRC64 <#{hexdigest}>" end |