Method: Rex::Text.block_api_hash

Defined in:
lib/rex/text/block_api.rb

.block_api_hash(mod, func) ⇒ String

Calculate the block API hash for the given module/function

Parameters:

  • mod (String)

    The name of the module containing the target function.

  • fun (String)

    The name of the function.

Returns:

  • (String)

    The hash of the mod/fun pair in string format



16
17
18
19
20
21
# File 'lib/rex/text/block_api.rb', line 16

def self.block_api_hash(mod, func)
  unicode_mod = (mod.upcase + "\x00").unpack('C*').pack('v*')
  mod_hash = self.ror13_hash(unicode_mod)
  fun_hash = self.ror13_hash(func + "\x00")
  "0x#{(mod_hash + fun_hash & 0xFFFFFFFF).to_s(16)}"
end