Common bitwise operations

Rotate left/right

malduck.bits.rol(value, count, bits=32)[source]

Bitwise rotate left

Parameters
  • value – Value to rotate

  • count – Number of bits to rotate

  • bits – Bit-length of rotated value (default: 32-bit, DWORD)

malduck.bits.ror(value, count, bits=32)[source]

Bitwise rotate right

Parameters
  • value – Value to rotate

  • count – Number of bits to rotate

  • bits – Bit-length of rotated value (default: 32-bit, DWORD)

Align up/down

malduck.bits.align(value, round_to)[source]

Rounds value up to provided alignment

malduck.bits.align_down(value, round_to)[source]

Rounds value down to provided alignment