Method: Rex::Text.rol

Defined in:
lib/rex/text.rb

.rol(val, cnt) ⇒ Object

Rotate a 32-bit value to the left by cnt bits

Parameters:

  • val (Fixnum)

    The value to rotate

  • cnt (Fixnum)

    Number of bits to rotate by



1874
1875
1876
1877
1878
1879
1880
# File 'lib/rex/text.rb', line 1874

def self.rol(val, cnt)
  bits = [val].pack("N").unpack("B32")[0].split(//)
  1.upto(cnt) do |c|
    bits.push( bits.shift )
  end
  [bits.join].pack("B32").unpack("N")[0]
end