HexDecoder

Version 1.0 29 April 2015

Summary

HexDeCoder is a simple hexadecimal, decimal, octal and binary number converter widget.

There is also an option to choose a custom base/radix between 2 and 36 and an option to convert between Unicode characters and their UTF-16 or UTF-8 character encodings.

This version also has an option to convert between IP(v4) addresses in dotted decimal notation and their hexadecimal, decimal and binary forms.

Description

The HexDeCoder widget provides a simple means of converting between different integer representations.

The widget provides four text boxes, one for each radix in use. An integer may be typed into any one of the text boxes and its representation in each of the other three radixes will appear in the other three boxes.

The widget works with 16-bit, 32-bit and 64-bit integers. The hexadecimal, octal and binary representations simply reflect the same bit patterns. The decimal representation also reflects exactly the same bit pattern, but the user can choose whether to regard the bit pattern as signed or unsigned.

Unsigned integer representation

Unsigned 16-bit integers can hold (decimal) values from 0 to 65535.
Unsigned 32-bit integers can hold (decimal) values from 0 to 4294967295.
Unsigned 64-bit integers can hold (decimal) values from 0 to 1152921504606846975.

In hexadecimal notation the same integers run from 0 to FFFF, FFFFFFFF and FFFFFFFFFFFFFFFF, respectively.

Signed (two's complement) integer representation

In the two's complement convention,

16-bit integers can hold (decimal) values from -32768 through 0 to +32767.
32-bit integers can hold (decimal) values from -2147483648 through 0 to +2147483647.
64-bit integers can hold (decimal) values from -9223372036854775808 through 0 to +9223372036854775807.

In hexadecimal notation, 16-bit negative integers run from 8000 through FFFF and 16-bit positive integers run from 0 through 7FFF.

In hexadecimal notation, 32-bit negative integers run from 80000000 through FFFFFFFF and 32-bit positive integers run from 0 through 7FFFFFFF.

In hexadecimal notation, 64-bit negative integers run from 8000000000000000 through FFFFFFFFFFFFFFFF and 64-bit positive integers run from 0 through 7FFFFFFFFFFFFFFF.

The representation of decimal integers can be toggled by clicking on the amber button (top left) which also indicates the current setting.

Unicode character encodings

There is an option to translate between Unicode characters and UTF-16 (16-bit number) or UTF-8 (8-bit number) encodings. The widget does not handle UTF-32 encodings.

IP(v4) address encodings

There is an option to translate between IP(v4) addresses in dotted decimal notation and their hexadecimal, decimal and binary forms.

Settings

The Word Length popup menu sets the word length to be used.

The octal base/radix can be replaced by any base/radix between 2 and 36. The Custom Base popup menu may also be used to set UTF-16, UTF-8 or IP(v4) translation mode.

There are also checkboxes to set full frame display and to display bit markers.
The bit markers can be displayed in either bigendian or little-endian form.
N.B. This is a display option only - it does not relate in any way to the byte-ordering of the underlying hardware.

Finally, there is an option to right justify (some of) the output.

License

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 2 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.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Widget Concept, Coding and Documentation

Harry Whitfield (G6AUC)