Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1476

Make Hex File

$
0
0
I found a need to use data samples in Hex format that were created using "C" based programs. The problem I ran into was the fact that they used lower case characters (eg 5a) and VB used upper case characters (eg 5A). Manually editing this information proved to be time consuming and prone to errors, so I made the attached program to do the job.

As an example, the samples provided by https://tls13.xargs.org/ range from:
Code:

202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f
to
Code:

16 03 03 00 7a 02 00 00 76 03 03 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 20 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff 13 02 00 00 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 9f d7 ad 6d cf f4 29 8d d3 f9 6d 5b 1b 2a f9 10 a0 53 5b 14 88 d7 f8 fa bb 34 9a 98 28 80 b6 15
Samples using space separators are much easier to read, but using no spaces is much quicker to convert to byte format.

To use this simple program, paste the string information into the upper text box. If the sample contains no spaces, the program will automatically convert lower case characters to upper case, add space separators, and display the result without spaces in the lower text box.

If the sample already contains spaces, the case conversion is done in the upper text box, and clicking the "Remove Spaces" transfers that information to the lower text box without spaces in a more convenient width.

To add that information to a file, use the "Save as File" button to enter the file name and path. By default, a ".hex" extension is added to the file name, and the file path is the current path. Files are created using File API calls.

J.A. Coutts
Attached Files

Viewing all articles
Browse latest Browse all 1476

Trending Articles