Solved

Hex Converter

Posted on 1999-01-25
9
418 Views
Last Modified: 2010-05-18
I would like to know, if someone could help me with, converting a say, exe-file into a hex number file. Sort of like Ultra Edit.
0
Comment
Question by:inkognito
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1363217
Take a look at
http://www.csd.net/~cgadd/knowbase/maincat.htm
You find all the examples you need
Hex to bin,
bin to hex.
dec to bin

0
 
LVL 1

Expert Comment

by:Smilly
ID: 1363218
Hello Inkognito,

First run thrue your text file, and get all the chars, then send them thrue this
converter.

function Dec2Hex(Dec: byte): string;
var Hi: byte;
    Low: byte;
begin
     Hi:=Dec div 16;
     result:=inttostr(Hi);
     Low:=Dec mod 16;
     case Low of
          10: result:=result+'A';
          11: result:=result+'B';
          12: result:=result+'C';
          13: result:=result+'D';
          14: result:=result+'E';
          15: result:=result+'F';
     else result:=result+inttostr(Low);
     end;
end;

I hope this helps, otherwise, giv me a comment.

Smilly
0
 

Author Comment

by:inkognito
ID: 1363219
The link you posted, seems to be very good, for future looking, though at writing time, I haven't had the time to look through the whole page, but I'll just hope for the best. Cuz the problems, is more or less, (problably due to my insufficent detailed question), that I need a fast converter from ASCII(string, dec) to Hex. I've used a BlockRead function, that could barley convert 1 Kb large Txt-filez, but it went so slow, that the program crashed, so I neede a simple / or not, version that won't hang it self, when filez up to a meg are read...
     I hope you understand my prolem, somehow better so that you can help me...?!
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 13

Expert Comment

by:Mirkwood
ID: 1363220
Here is a very fast conversion function, is that what you need?

Function Byte2Hex(Number: Byte) : String;
Begin    
    Ch1 := Number SHR 4;
    Ch2 := Number - (Ch1 SHL 4);    Byte2Hex := Hexa[Ch1]+Hexa[Ch2];
End;


0
 

Author Comment

by:inkognito
ID: 1363221
Could you please implement (is it spelled this way?), this function in a little for ... loop, which would go through the whole file. Not that I'm totally bonkers, just don't have the time to try and wait for a result taht could work without too much trouble. And since you're obviously not a new-beginner which I'm Please Help Me!!!!!!!(Am I deperate?)
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1363222
Sounds like a assignment to me. But OK

Download hexview from http://www.belhard.minsk.by/delphi/D20F5.HTM

Last answer...

0
 
LVL 3

Expert Comment

by:rickpet
ID: 1363223
You can find one ...\Borland\Delphi #\Demos\RESXPLOR

look at hexdump.pas


Rick
0
 

Author Comment

by:inkognito
ID: 1363224
Well I just have to start by thanking Mirkwood, for the suggestions on my problem, however, I visited the site,
http://www.belhard.minsk.by/delphi/D20F5.HTM, which had a perfect
HexViewer for my purposes, but it didn't have a complete code. Cuz it requested a THexDump component that I didn't find in the Zip-archive, so I'm getting desperate! Please someone out there...
0
 
LVL 3

Accepted Solution

by:
rickpet earned 200 total points
ID: 1363225
I guess you didn't read my comment...Thexdump can be found at

You can find one ...\Borland\Delphi #\Demos\RESXPLOR

Rick
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Strange behavior when a form is closed 6 68
Base1 Encode/Decode 3 85
Dynamically Created Query 3 69
Multi-layered image in FireMonkey 9 67
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question