Files
metasploit-gs/lib/msf/core/encoding/xor.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
508 B
Ruby
Raw Normal View History

# -*- coding: binary -*-
2005-05-21 17:57:00 +00:00
module Msf
module Encoding
###
#
# This class provides basic XOR encoding facilities and is used
# by XOR encoders.
#
###
class Xor
2005-11-15 15:11:43 +00:00
#
# Encodes a block using XOR.
#
2005-05-21 17:57:00 +00:00
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
2005-05-21 17:57:00 +00:00
return oblock
end
end
end end