Class: Digest::CRC32
- Inherits:
-
Class
- Object
- Class
- Digest::CRC32
- Includes:
- Instance
- Defined in:
- lib/rake/helpers/digest.rb
Instance Method Summary collapse
- #finish ⇒ Object
- #hexdigest_to_digest(h) ⇒ Object
-
#initialize ⇒ CRC32
constructor
A new instance of CRC32.
- #reset ⇒ Object
- #update(str) ⇒ Object
Constructor Details
#initialize ⇒ CRC32
Returns a new instance of CRC32.
13 14 15 |
# File 'lib/rake/helpers/digest.rb', line 13 def initialize reset end |
Instance Method Details
#finish ⇒ Object
21 22 23 |
# File 'lib/rake/helpers/digest.rb', line 21 def finish @crc32.to_s end |
#hexdigest_to_digest(h) ⇒ Object
25 26 27 |
# File 'lib/rake/helpers/digest.rb', line 25 def hexdigest_to_digest(h) h.unpack('a2' * (h.size / 2)).collect { |i| i.hex.chr }.join end |
#reset ⇒ Object
17 18 19 |
# File 'lib/rake/helpers/digest.rb', line 17 def reset @crc32 = 0 end |
#update(str) ⇒ Object
9 10 11 |
# File 'lib/rake/helpers/digest.rb', line 9 def update(str) @crc32 = Zlib.crc32(str, @crc32) end |