Class: Msf::Encoding::Xor
- Inherits:
-
Object
- Object
- Msf::Encoding::Xor
- Defined in:
- lib/msf/core/encoding/xor.rb
Overview
This class provides basic XOR encoding facilities and is used by XOR encoders.
Class Method Summary collapse
-
.encode_block(key, block, block_size = 4, block_pack = 'V') ⇒ Object
Encodes a block using XOR.
Class Method Details
.encode_block(key, block, block_size = 4, block_pack = 'V') ⇒ Object
Encodes a block using XOR.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/msf/core/encoding/xor.rb', line 16 def Xor.encode_block(key, block, block_size = 4, block_pack = 'V') offset = 0 oblock = '' while (offset < block.length) cblock = block[offset, block_size].unpack(block_pack)[0] cblock ^= key oblock += [ cblock ].pack(block_pack) end return oblock end |