Terminal based bitwise calculator in curses

Build Status {focus_keyword} mellowcandle/bitwise 68747470733a2f2f7472617669732d63692e6f72672f6d656c6c6f7763616e646c652f626974776973652e7376673f6272616e63683d6d6173746572codecov {focus_keyword} mellowcandle/bitwise 68747470733a2f2f636f6465636f762e696f2f67682f6d656c6c6f7763616e646c652f626974776973652f6272616e63682f6d61737465722f67726170682f62616467652e737667
Snap Status {focus_keyword} mellowcandle/bitwise 68747470733a2f2f6275696c642e736e617063726166742e696f2f62616467652f6d656c6c6f7763616e646c652f626974776973652e737667
Coverity Scan Build Status {focus_keyword} mellowcandle/bitwise 68747470733a2f2f696d672e736869656c64732e696f2f636f7665726974792f7363616e2f31383137302e737667
GitSpo Mentions {focus_keyword} mellowcandle/bitwise 68747470733a2f2f67697473706f2e636f6d2f6261646765732f6d656e74696f6e732f6d656c6c6f7763616e646c652f626974776973653f7374796c653d666c61742d737175617265

Bitwise is multi base interactive calculator supporting dynamic base convertion and bit manipulation.
It’s a handy tool for low level hackers, kernel developers and device drivers developers.

Some of the features include:

  • Interactive ncurses interface
  • Command line calculator supporting all bitwise operations.
  • Individual bit manipulator.
  • Bitwise operations such as NOT, OR, AND, XOR, and shifts.

IRC support

#bitwise @ irc.oftc.net

Demo {focus_keyword} mellowcandle/bitwise bitwise

Usage

bitwise can be used both Interactively and in command line mode.

Command line calculator mode

In command line mode, bitwise will calculate the given expression and will output the result in all bases including binary representation.

bitwise detects the base by the preface of the input (0x/0X for hexadecimal, leading 0 for octal, b for binary, and the rest is decimal).

Examples:

Simple base conversion

conversion {focus_keyword} mellowcandle/bitwise cmdline

C style syntax Calculator

calculator {focus_keyword} mellowcandle/bitwise conversion

Interactive mode

bitwise starts in interactive mode if no command line parameters are passed or if the -i | –interactive flag is passed.
In this mode, you can input a number and manipulate it and see the other bases change dynamically.
It also allows changing individual bits in the binary.

Navigation in interactive mode

To move around use the arrow keys, or use vi key bindings : h j k l .
Leave the program by pressing q .

Binary specific movement

You can toggle a bit bit using the space key.
You can jump a byte forward using w and backwards one byte using b .

Bitwise operation in interactive mode

Setting the bit width:

Reducing or extending the bit width interactively is also very easy, just use:
! for 8bit, @ for 16Bit, $ for 32Bit and * for 64Bit.
When changing the bit width, the number is masked with the new width, so you might lost precision, use with care.

NOT:

Press ~ to perform the NOT operator.

expression calculator in interactive mode

You can enter expression calculator mode by typing : (Just like in vim).

To exit the mode, just press ESC .

In this mode, you can type any expression you like to be evaluated.
The result will be printed in the history window and also printed in the binary and various bases on top.

operators and functions
  • All C operators are supported, additionaly, you can use the “$” symbol to refer to the last result.
  • refer to a specific bit by using the function BIT(x).
commands
  • clear – to clear the history window.
  • q – to exit

Installation

Linux

Ubuntu

sudo add-apt-repository ppa:ramon-fried/bitwise
sudo apt-get update
sudo apt-get install bitwise

Snap

If your distribution supports Snap just type:
sudo snap install bitwise

Arch

Your can use the AUR repository: https://aur.archlinux.org/packages/bitwise/

Windows

No, wait. really ???

Building from source

Make sure you have ncurses package installed

  • Download the latest release
tar xfz RELEASE-FILE.TAR.GZ
cd RELEASE-DIR

./configure
make
sudo make install

Read More

LEAVE A REPLY

Please enter your comment!
Please enter your name here