04-01-2011, 08:59 AM
(04-01-2011, 01:00 AM)latch Wrote:(03-01-2011, 09:24 PM)Drumm Wrote: It is possible to do this with some kind of library, but I wanted too challenge myself to learn how to convert Decimal to Hex in my mind.
It's rather simple tbh, I'll explain if somebody asks.
I'm impressed that you even care about hex.
I only code once or twice a month(my environment is not conducive to concentration) and read hex about that often. Even programmers don't use hex much anymore as far as I know. High level languages don't get that close to the machine.
Hex(base16) is still widely used, but mainly because it is a hell of a lot easier to write 0x9B6D than to write the binary(base2) equivalent of 1001101101101101. It is used generally in "lower" level languages such as C/C++ and ASM, although almost all languages allow for it. The programs' purpose will determine whether or not the inclusion of hex is necessary.
For example the program I have been working on recently steps through 512 bytes of raw data. The code I wrote is 90% operating on different hex values with regard to their position, value and significance. The 512 bytes if looked at as a whole would be called the MBR(master boot record) of a Windows NTFS volume. The program specifically analyzes bootkits (MBR rootkits) and in the short term allows for reverse engineering and disinfection. In the long run it is merely a piece of my master suite of software I have been working on since I was your age.
Although all numbers can be displayed in whatever base form you would like the relationship between hex and binary is more relevant than hex and decimal(base10.) If you are debugging a program you are generally going to need to be able to reference the memory address space your program is using. This is shown in hex. If you ever want to be able to find a flaw in the new ios you will have to understand how to reverse engineer it. This will leave you with a shit load of lines of assembly code with operators on hexadecimal values representing memory space and the processor register. If you ever hope to write a buffer overflow it is an exercise of pushing more data in a space of memory than the program is designed to handle in certain strategic places. It is necessary to write a program to find these strategic points, and to find out what opportunities these strategic points in turn offer you the ability to do. You will certainly be manipulating hexadecimal values if you ever get this far down the road.
Trolls are the last thing you need to be concerned with.
VCD Wrote:// Forever more, count and reply, bitch.