/hextodec

Convert hexadecimal values to decimal format from the command line.

Primary LanguageC++GNU General Public License v3.0GPL-3.0

Hex To Dec Hex To Dec Logo

Readme Card



About

All files can be found at the Releases page.

Description

A simple command line tool to convert hexadecimal values of any format (e.g: ff, #ff, or 0xff) into decimal format with the option of padding with prepended zeros (e.g: ff == 15). The padding option is a just a convenience for certain set-width displays so we don't have to do any post-formatting.

Motivation

I very often need to convert said values with various formats and I tend to mostly work in the command line.


Usage

Environment

This is a command line tool for both Windows and Linux.

How To Use

Both the Windows and Linux version's have portable executables, but the Linux version also provides and Debian (.deb) package for installation on Debian based Linux systems. I have no experience building packages for other types or Linux package managers, but if you would like to fork, create, build, and release this project yourself then, please (as per the license), be my guest.

Windows Use

Windows Portable

As with any portable program this can be placed anywhere you like on your machine, but more preferably in a directory that is in your %PATH% environment variable so you can run it without a full path (hextodec for example). I recommend using a dedicated Bin directory, but of course, it's your choice. If your path isn't already in your %PATH% environment then I suggest adding it[1], but if not then you have provide the full path (C:\Path\To\hextodec.exe for example) when executing the program.

Windows Installation

There's really no need for installation in Windows and it is more hassle than necessary to do so. Of course, it can be done with whatever installation software (MSI, Inno, or similar) and adding the programs path to %PATH%, but there's no point that can I can see. If enough people ask for it I may do so in the future.

Linux Use

Linux Portable

Nearly the same concept as with Windows (path is $PATH, of course) and you can use your own bin directory (~/bin for example), but there is usually a dedicated bin directory at ~/.local/bin where I recommend placing the executable if you don't install it using the Debian package.

Debian Installation

The provided .deb (Debian package) installer provides a man page and a very basic Bash Completion file.

To install with the .deb package you can either use dpkg or gdebi[-gtk]:

With dpkg:

 $ sudo dpkg -i /path/to/deb/installer/hextodex.deb

With gdebi[-gtk]:

 $ sudo gdebi /path/to/deb/installer/hextodex.deb
 # or; don't use sudo with the GTK version
 $ gdebi-gtk /path/to/deb/installer/hextodex.deb

View Man Page:

 $ man hextodec

Examples

These examples are essentially the same in both Windows and Linux with the exception of the switch formats. Windows follows the Windows style (/help for example) and Linux follows the Linux style (--help for example). If the executable is not in the Windows %PATH% then you must provide the full path plus the .exe extension. If the executable is not in the Linux $PATH then you must provide the full path.

Help message:

 > hextodec /h

  Hexadecimal To Decimal - Convert hexadecimal values to decimal format.
  hextodec [OPTIONS [VALUES]]

  @OPTIONS
    /h, /help         This help message.
    /x, /hexadecimal  The HEXADECIMAL number to convert.
    /p, /padding      DECIMAL number of 0's to prepend to the result.

  @VALUES
    HEXADECIMAL       Base 16 value; [0-9a-f]
    DECIMAL           Base 10 value; [0-9]

Convert 0xFF (or FF or #FF) to it's corresponding decimal value in Windows (works the same in PowerShell and CMD, of course):

 > hextodec /x 0xff
255

Convert 0xF (or F or #F) to it's corresponding decimal value and ensure a 3 width in Windows:

 # ` to escape # in PowerShell (or quote: '#f'), not necessary in CMD 
 > hextodec /x `#f /p 3
015

The same in Linux

 $ hextodec -x ff
255

Project Information

This project is written in C++.

C++

Source File Quality

This is graded by CodeFactor and is subjective, but helps me to refactor my work.

Name Status
codefactor.io

File MD5 Hashes

All hashes are retrieved at compile/build time.

Current Windows X86 MD5

WINDOWS X86 MD5

Current Windows X64 MD5

WINDOWS X64 MD5

Current Linux MD5

LINUX MD5

Current Debian Installer MD5

DEBIAN MD5

Other Miscellaneous File Information

Description Status
Project Release Date GitHub Release Date
Total downloads for this project GitHub all releases
Complete repository size This Repo Size
Commits in last month GitHub commit activity
Commits in last year GitHub commit activity

Media

Logo

LOGO

Help

HELP

Linux Man Page

LINUX MAN PAGE


Support Me If You Like

If you like any of the projects below and care to donate to my PayPal:

PayPal Donation

Or Buy Me A Coffee if your prefer:

Buy Me A Coffee


License Info

License Excerpt
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.