In this section : hexa | bin.
Hexadecimal numbers
hexadecimal numbers are integers which are displayed in hexadecimal mode.
123
is displayed as 0x7B
in hexa.
Hexa numbers start with "0x
" in RPNenh, which notation is widely used in C or others...
Entering hexa numbers
you have two ways to enter hexa numbers :
- click on new 0x (can be found on base menu)
- by entering a Decimal number (
123
for example) and by pressing >HEX
Operations on hexa
In fact all operation about number are possible with hexa (because finaly an hexa is an interger!)
you can for example perform +, -, *, / ...
Conversion
You can convert an hexa to a BIN or an DECIMAL by >BIN and >DEC
Obviously you can convert a number or a binary into an hexa by using function >HEX.
Thanks to lists, conversion works also in mass :
you can convert a full list of hexa into integers, example { 0x22 0x33 #1111 }
>DEC gives {34 51 15}
.
String usage
there are two functions from string area that use hexa.
- asc give the ASCII code of a char into hexa. ex:
"a"
asc returns 0x61
.
- chr perform the reversal. it gives the char. ex
0x61
chr returns "a"
.
Note : chr works also with binary and interger like #01100001 or 97.
On string, asc and chr works with a list of hexa.
"a"
asc returns 0x61
(one char)
"abc"
asc returns { 0x61 0x62 0x63 }
(serveral char give serveral hexa)
Obviously, chr accept a list of hexa and rebuilt the string.
{ 0x61 0x62 0x63 }
chr returns "abc"
Specific functions
hexa->str
This function take a list of hexa number and put them together into a list.
ex : { 0x61 0x62 0x63 }
hexa->str returns "616263"
str->hexa
This function perform the reversal. you need to precise the number of byte for each hexa
ex : "616263"
1
str->hexa returns { 0x61 0x62 0x63 }
ex : "616263"
2
str->hexa returns { 0x6162 0x6300 }
usage ex : "hello!"
md5 1
str->hexa sum compute the sum of each byte of the md5 hash of the string "hello!" (the sens of that ? none, it was just an example)
Binary numbers
As hexadecimal, Binary numbers are integers which are displayed in binary mode.
123
is displayed as #01111011
in BIN.
Binary numbers start with "#" in RPNenh.
Entering Bin numbers
you have 3 ways to enter bin numbers :
- hit the # key - this is the simpliest way to enter a binary
- click on new # (can be found on base menu)
- by entering a Decimal number (
123
for example) and by pressing >BIN
Conversion
Use >BIN to convert any number (even hexa..) into a binary number.
You can convert a binary number into an integer >DEC, an hexa >HEX...
>BIN works also on list, it convert each list item into binary...
---UNDER CONSTRUCTION ---