lib/zklib/helper.rb
# Create checksum for execution
#
# param  options
#        |_ data  Data to create checksum
Create checksum for execution
param  options
|_ data  Data to create checksum
Create checksum for execution param options |_ data Data to create checksum
def create_checksum(options)
      data = options[:data]
      checksum = 0
      (0...data.length).step(2) do |i|
        checksum += (i == data.length - 1) ?
          BinData::Uint8le.read(data[i]).snapshot :
          BinData::Uint16le.read(data[i..-1]).snapshot
        checksum %= USHRT_MAX
      end
      chksum = USHRT_MAX - checksum - 1
      chksum
    end
def create_checksum ( options ) data = options [ :data ] checksum = 0 ( 0 ... data . length ) . step ( 2 ) do | i | checksum += ( i == data . length - 1 ) ? BinData :: Uint8le . read ( data [ i ] ) . snapshot : BinData :: Uint16le . read ( data [ i .. - 1 ] ) . snapshot checksum %= USHRT_MAX end chksum = USHRT_MAX - checksum - 1 chksum end
Create checksum for execution
param  options
|_ data  Data to create checksum
Create checksum for execution param options |_ data Data to create checksum
options