We help IT Professionals succeed at work.

Easiest Ascii to Hex program?

fost0127
fost0127 asked
on
This was the only forum I could think to ask...

If I have a file that is nothing but an ascii text file of hex code how can i get it to be hex code... so the file contents are like

d0cf00ff

and so on...  It is quite long so I don't want to cut and paste too much.  The text is in one long continuous line so no spaces or line breaks.  Any ideas?

Thanks so much
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2008
Commented:
1. Reading the given ASCII file sequential you can read the characters pairwise. Let us think that you have read D and 0.
2. Convert D0 in integer. To do this use a table like
Character   Number
0           0
1           1
2           2
...        ...
9           9
a           10
b           11
c           12
d           13
e           14
f           15
You can use 2 arrays (one character, second integer).
In the case of D0 you find that D (or d) is on position 14 in the array. 0 is on position 1.
Calculate (14-1)*16+(1-1)*1 = 108
So you will calculate that D0 is in place 108 of your ASCII table.

3.In every programming language you can find a character function (VAL or ASCII or something else) with a integer parameter. It returns the character in the ASCII table on the given position.

4. Save the returned value in a character variable and/or move it to character array

5. Try to figure out if your programming language supports function for direct conversion of characters into ASCII or integer. This will help you to avoid some of tjhe above steps.
dbruntonQuid, Me Anxius Sum?  Illegitimi non carborundum.
CERTIFIED EXPERT

Commented:
Try this link

http://www.simtel.net/pub/msdos/binaryed/

There's a lot of hex and binary  and ascii editors here.  One of these should be suitable for the job.

Commented:
Are you looking for a small program which does the job or do you want to have some help coding on it yourself ?
YES! and you already have it on your computer (Microsoft Operating systems).

It's called 'DEBUG'

At a DOS prompt, type
   DEBUG file.txt
or whatever your file name.

type D {enter}
to display your data.

Usually, non-EXE files will start at offset 100, so you can type
D100 {enter}
to display from the start of the file.
Of course, we could always write you a simple utility that converts the stuff to HEX and outputs to a different file.

Author

Commented:
Actaully I ended up using Frhed...  I don't have to insert lines line numbers and what not.  The only nasty part is cutting and pasting the data chunk of a packet.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.