I've observed few reverse engineers, they convert decimal to hexadecimal so fast in mind. It's simply amazing. I never got chance to ask them. Personally, I really suck it this conversion and I always use a calculator for conversion.
I was wondering if there is some kind of short cut for this conversion?
I think especially for a reverse engineer & a low level (Assembly, Embedded) programmer. Its a BIG PLUS if he can count, add, subtract and think in terms of HEX instead of decimal. If you have any tips for this, kindly share.
You need to know the basic conversions 0-16, 0x0-0xF and 0b0-0b1111 conversions by hart.
The rest you learn with repetition. The are some often repeated patterns to watch for.
Multiples:
Similar for bit positions you can learn the decimal values
These patterns repeat everywhere and with time you will start to learn them.
If you have a binary representation it is easy to group the bits in groups of four and quickly convert to a binary representation.
The only realistic way to find the decimal value 0xA1B587DE is to use a calculator(or be unbelievably good at maths). But the nearest 1k boundary down from 0xA1B587DE is 0xA1B58400 which is easy if you know the patterns.
From your comments on opcode:
For RISC processors most instructions just the first few bits in an instruction word defines the family of instruction (mov, jump, and, or, ...) and the rest is just parameters. If you work with a processor enough you will start to learn them.
It is quite simple once you understand the base of the numbering systems involved. Hexadecimal is base 16 - so, 1(dec) = 0x01; but 16(dec) = 0x10.
whenever you see a decimal number, say, 39:
divide it by 16 and just take the quotient - this is 2 (2*16 = 32) remainder is 7 ( 39 - 32 )
The HEX value of decimal 39, is therefore: 0x27.
Now, convert it back to decimal: 0x27 = 2*16 + 7 = 39 decimal :)
Hope you got the idea!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With