Skip to content

0xFrxst/Binary-Convert-Tool

Repository files navigation

Binary Conversion Tool

A sophisticated C++ binary conversion utility that supports bidirectional conversion between binary and various data formats including decimal numbers, hexadecimal, octal, IP addresses (IPv4 and IPv6), text, offsets, and more.

Features

Number Conversions

  • Decimal ↔ Binary: Convert decimal numbers to binary representation and vice versa
  • Hexadecimal ↔ Binary: Convert hexadecimal values (with or without 0x prefix)
  • Octal ↔ Binary: Convert octal representations to and from binary
  • Custom bit width: Specify custom bit widths for conversions

IP Address Conversions

  • IPv4 ↔ Binary: Convert IPv4 addresses (e.g., 192.168.1.1) to 32-bit binary
  • IPv6 ↔ Binary: Convert IPv6 addresses to 128-bit binary representation
  • Auto-validation: Built-in validation for proper IP address formats

Text Conversions

  • Text ↔ Binary: Convert ASCII text to binary representation (UTF-8 compatible)
  • Byte output: Display binary data as hexadecimal byte representations

Offset/Address Conversions

  • Offset → Binary: Convert memory offsets and addresses (hex or decimal format)
  • Binary → Offset: Convert binary back to offset notation (hex format with 0x prefix)

Utility Features

  • Binary formatting: Format binary strings with custom group sizes and separators
  • Binary to bytes: Convert binary strings to byte arrays
  • Interactive menu: Easy-to-use console interface with 16 different conversion options

Building the Project

Requirements

  • Visual Studio 2017 or later
  • Windows SDK 10.0
  • C++ compiler supporting C++11 or later

Build Steps

  1. Open BinaryConvert.sln in Visual Studio
  2. Select your desired build configuration (Debug/Release) and platform (x86/x64)
  3. Build the solution (Build → Build Solution or press F7)
  4. Run the executable from the output directory

Alternatively, you can build from the command line:

msbuild BinaryConvert.sln /p:Configuration=Release /p:Platform=x64

Usage

Running the Tool

Simply run the executable to access the interactive menu:

BinaryConvert.exe

Menu Options

  1. Decimal to Binary - Convert decimal numbers to binary (e.g., 255 → 11111111)
  2. Binary to Decimal - Convert binary strings to decimal numbers
  3. Hexadecimal to Binary - Convert hex values (with or without 0x prefix)
  4. Binary to Hexadecimal - Convert binary to hex format
  5. Octal to Binary - Convert octal numbers to binary
  6. Binary to Octal - Convert binary to octal format
  7. IPv4 Address to Binary - Convert IPv4 addresses to binary
  8. Binary to IPv4 Address - Convert 32-bit binary to IPv4
  9. IPv6 Address to Binary - Convert IPv6 addresses to binary
  10. Binary to IPv6 Address - Convert 128-bit binary to IPv6
  11. Text to Binary - Convert text strings to binary
  12. Binary to Text - Convert binary strings to text
  13. Offset/Address to Binary - Convert offsets to binary
  14. Binary to Offset/Address - Convert binary to hex offset notation
  15. Format Binary String - Format binary with custom grouping
  16. Binary to Bytes - Display binary as hexadecimal bytes

Example Conversions

Decimal to Binary

Input: 255
Bit width: 8
Output: 11111111

IPv4 to Binary

Input: 192.168.1.1
Output: 11000000.10101000.00000001.00000001

Text to Binary

Input: Hello
Output: 01001000 01100101 01101100 01101100 01101111

Offset to Binary

Input: 0x400
Output: 010000000000

Code Structure

BinaryConvert/
├── BinaryConvert.sln          # Visual Studio solution file
├── BinaryConvert.vcxproj      # Visual Studio project file
├── BinaryConverter.h          # Header file with class interface
├── BinaryConverter.cpp        # Implementation of conversion logic
├── main.cpp                   # Main entry point with interactive menu
└── README.md                  # This file

Technical Details

BinaryConverter Class

The core functionality is provided by the BinaryConverter class with static methods for all conversions:

  • All methods include validation and error handling
  • Input sanitization removes whitespace automatically
  • Support for common prefixes (0x for hex, 0 for octal)
  • Proper handling of negative numbers using two's complement
  • IPv6 addresses support compressed notation (::)

Error Handling

All conversion methods include comprehensive error handling with descriptive error messages for:

  • Invalid input formats
  • Out-of-range values
  • Malformed IP addresses
  • Invalid binary strings

Notes

  • All conversions are case-insensitive where applicable
  • Binary strings can include or exclude whitespace (automatically stripped)
  • IP address validation follows RFC standards
  • The tool handles both signed and unsigned integer representations

License

This project is provided as-is for educational and professional use.

About

A all-in-one Binary Conversion tool to convert to-and-from binary!

Resources

License

Stars

Watchers

Forks

Packages

No packages published