File Conversion:Binary to Hexadecimal & Back
If you have ever used a hexadecimal file editor you will be familiar with the hexadecimal representation of the file that is used for viewing and editing its contents. Use the download link below to see how this can be done using Delphi. The demo application performs a binary to hex conversion and then reverses it. The time required for the two conversions is reported. Note that timings based on the system clock - as done by us - in a preemptive multitasking environment are inherently unreliable. The actual time requirements will typically be lower than those reported. The hexadecimal version of your input file is saved with the file extension .hex. The back-converted file is stored with the file extension .unhex. You may wish to compare the .unhex file with the one you originally supplied using a tool such as WinHex.
We make extensive use of lookup tables to deliver extremely rapid conversions - even for very large files. In addition, we use techniques that replace conditional testing with simple arithmetic, once again in the interests of speed.
Download