You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: xor_additive_feedback.rb
    path of file: ./repos/metasploit-framework/lib/msf/core/encoder
    
    the code of the file until where you have to start completion: # -*- coding: binary -*-

###
#
# This class performs per-block XOR additive feedback encoding.
#
###
class Msf::Encoder::XorAdditiveFeedback < Msf::Encoder::X
    
  def encode_block(state, block)
    # XOR the key with the current block
    orig       = block.unpack(decoder_key_pack)[0]
    oblock     = orig ^ state.key

    # Add the original block contents to the key
    state.key  = (state.key + orig) % (1 << (decoder_key_size * 8))

    # Return the XOR'd block
    return [ oblock ].pack(decoder_key_pack)
  end