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



1676
1677
1678
1679
1680
1681
1682
# File 'lib/rex/text.rb', line 1676

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