Method: Digest::CRC32.pack

Defined in:
lib/digest/crc32.rb

.pack(crc) ⇒ String

Packs the CRC32 checksum.

Parameters:

  • crc (Integer)

    The checksum to pack.

Returns:

  • (String)

    The packed checksum.



92
93
94
95
96
97
98
99
100
101
# File 'lib/digest/crc32.rb', line 92

def self.pack(crc)
  buffer = ''

  buffer << ((crc & 0xff000000) >> 24).chr
  buffer << ((crc & 0xff0000) >> 16).chr
  buffer << ((crc & 0xff00) >> 8).chr
  buffer << (crc & 0xff).chr

  buffer
end