Hex to Dec

03/13/2013 02:04 |xabi|#1
hey brothers, in my source i'd like to convert Hex to Dec
is there idea for converting by debugging the project? and how would it be liked?
03/13/2013 02:25 go for it#2
i don't think it could be done but manually
search entire project for "0x"
open the calculator or code a simple app
copy and past manually
else
code simple c# app.
select all text and past them to this app. text box
a cute button which do the following
loop on all strings
once found "0x"
select chars starting with that 0 ending with the next space ' ' or next ')'
lets say the string it found was 0xc3
//it will keep searching for the next space char as any hex number should end with space or ')'
copy this string (which is the number in hex)
then convert it to dec
by
Code:
String decimal = new Org.BouncyCastle.Math.BigInteger(hex, 16).ToString();
or
Code:
// Store integer 182
int decValue = 182;
// Convert integer 182 as a hex in a string variable
string hexValue = decValue.ToString("X");
// Convert the hex string back to the number
int decAgain = int.Parse(hexValue, System.Globalization.NumberStyles.HexNumber);
or any other way , go search google or msdn

then simply replace the dec value for the hex value
//take a copy from the hex value before converting or use the copy you already selected as you are not sending reference you are only sending copy and do something like main string replace(hex variable,dec variable)

once it loop on all the hex values it will convert all of them
i may release a tool like this later (im going to bed atm)

the point was to be able to detect the hex value to replace it
all you know about hex value is that it start with 0x and end with space or bracket , but maybe also in for loop it will end with semicolon ;

so i guess that's the 3 chars following any hex value
it end at the closest value to your selection (the start of 0x)

edit about your sig
and btw i think it's hybrid who wrote the cv3

edit 2 , hex numbers may also end with ',' , ex. at packets 0x00, 0x01, 0x44,

edit 3 , you may also make a simple log about what you edit
text box , scroll to crate , vertical and horizontal scroll bars , method of text += new text + /r/n , write hex value + /t + dec value
it will log something like

Quote:
0x01 1
0x05 5
0x0c 12
so you figure out if all conversations went smooth

edit 5
and please don't fucking tell me that all you want was to convert a value and not all values in the source :\
03/13/2013 02:29 Spirited#3
"In mathematics and computer science, hexadecimal (also base 16, or hex) is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F (or alternatively a–f) to represent values ten to fifteen. For example, the hexadecimal number 2AF3 is equal, in decimal, to (2 × 163) + (10 × 162) + (15 × 161) + (3 × 160), or 10995.

Each hexadecimal digit represents four binary digits (bits), and the primary use of hexadecimal notation is a human-friendly representation of binary-coded values in computing and digital electronics. One hexadecimal digit represents a nibble, which is half of an octet or byte (8 bits). For example, byte values can range from 0 to 255 (decimal), but may be more conveniently represented as two hexadecimal digits in the range 00 to FF. Hexadecimal is also commonly used to represent computer memory addresses."

If you don't understand any of that.... no problem. Consider going to school though. Here's a converter: [Only registered and activated users can see links. Click Here To Register...]
03/13/2013 02:32 go for it#4
Quote:
Originally Posted by Fаng View Post
"In mathematics and computer science, hexadecimal (also base 16, or hex) is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F (or alternatively a–f) to represent values ten to fifteen. For example, the hexadecimal number 2AF3 is equal, in decimal, to (2 × 163) + (10 × 162) + (15 × 161) + (3 × 160), or 10995.

Each hexadecimal digit represents four binary digits (bits), and the primary use of hexadecimal notation is a human-friendly representation of binary-coded values in computing and digital electronics. One hexadecimal digit represents a nibble, which is half of an octet or byte (8 bits). For example, byte values can range from 0 to 255 (decimal), but may be more conveniently represented as two hexadecimal digits in the range 00 to FF. Hexadecimal is also commonly used to represent computer memory addresses."

If you don't understand any of that.... no problem. Consider going to school though. Here's a converter: [Only registered and activated users can see links. Click Here To Register...]

i bet he wasn't asking about how to convert a single value o-0
i so doubt he want to know how to convert hex base to dec base

but most likely it's what i guessed
in edited trinity some freak replaced all dec values with hex values and he want to convert them all back with a non manual way

ill go burn myself if he was really asking how to convert hex base to dec base :'(
03/13/2013 02:57 agathom#5
heres i found on my book mark..

[Only registered and activated users can see links. Click Here To Register...]
03/13/2013 08:37 urgabel#6
Quote:
Originally Posted by Fаng View Post
For example, the hexadecimal number 2AF3 is equal, in decimal, to (2 × 163) + (10 × 162) + (15 × 161) + (3 × 160), or 10995.

The way you wrote that could confuse anybody who does not understand hexadecimal numbers. I know this forum does not support superscripts, but I propose to do it this way:

0x2AF3 = (2 × 16³) + (10 × 16²) + (15 × 16¹) + (3 × 16°) = 10995
03/13/2013 12:26 |xabi|#7
Thanks all of you but as go for it said i didn't want to Convert to single value!!
i already knew by using calc.
#go for it thank you i got you as it your idea right but it boring :) Because every value will use it by the cute GUI that suppose i made.
maybe i can re-solve it by using Ctrl + H in the c#
search for and replace it easier than yours but anyway thanks for trying to help me :)
03/13/2013 18:05 go for it#8
Quote:
Originally Posted by |xabi| View Post
Thanks all of you but as go for it said i didn't want to Convert to single value!!
i already knew by using calc.
#go for it thank you i got you as it your idea right but it boring :) Because every value will use it by the cute GUI that suppose i made.
maybe i can re-solve it by using Ctrl + H in the c#
search for and replace it easier than yours but anyway thanks for trying to help me :)
i know you were not that stupid to ask about converting single value :P
it's easier but less professional and more tiring
today before i go to the college i started a c# app. called IEditor
this app. will replace all that values for you automatically and give you log of listbox with stripping menu to restore a value or restore all or edit certain value
you are searching for unknown values/strings with unknown length
and you may apply scripts to them

so far in two hours i made the main engine , will work on that once i wake up and sure will be done tomorrow with more options and more pre made scripts
you may expect it tomorrow (may release it with small script engine)
engine will let you add letters or remove letters or do anything to strings , also will let you convert from any base to any base

gosh i forgot
you search for that values/strings by searching for certain chars which that words/values may begin and end with

tomorrow ill be releasing it and maybe will release the code source for others to learn as i'm learning good stuff throw coding it and sure others will :)
03/13/2013 20:56 |xabi|#9
Quote:
Originally Posted by go for it View Post
i know you were not that stupid to ask about converting single value :P
it's easier but less professional and more tiring
today before i go to the college i started a c# app. called IEditor
this app. will replace all that values for you automatically and give you log of listbox with stripping menu to restore a value or restore all or edit certain value
you are searching for unknown values/strings with unknown length
and you may apply scripts to them

so far in two hours i made the main engine , will work on that once i wake up and sure will be done tomorrow with more options and more pre made scripts
you may expect it tomorrow (may release it with small script engine)
engine will let you add letters or remove letters or do anything to strings , also will let you convert from any base to any base

gosh i forgot
you search for that values/strings by searching for certain chars which that words/values may begin and end with

tomorrow ill be releasing it and maybe will release the code source for others to learn as i'm learning good stuff throw coding it and sure others will :)
thanks bro :)
[allah y5leek ya prince el sense :D]
03/17/2013 19:18 !KrAToS!#10
Why to make your self tired
here is the best & fastest way
[Only registered and activated users can see links. Click Here To Register...]
03/17/2013 20:07 |xabi|#11
thanks for trying me but really you didn't understand what iam talking about.
03/17/2013 21:09 M.Dego#12
Quote:
Originally Posted by |xabi| View Post
thanks for trying me but really you didn't understand what iam talking about.
u mean convert all values in source by 1 click :D ??
03/17/2013 21:47 |xabi|#13
Quote:
Originally Posted by M.Dego View Post
u mean convert all values in source by 1 click :D ??
i like ur :D post :D
el targma :D
ya3gbny feek mola7ztk el mawdo3ya xD
03/18/2013 03:22 _tao4229_#14
[Only registered and activated users can see links. Click Here To Register...]
03/19/2013 05:26 go for it#15
[Only registered and activated users can see links. Click Here To Register...]