Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hex to binary using VBScript

Is it possible to convert a Hexdump to binary using VBS? I made a program that reads any file as Byte array, then it converts it to Hex. In output Hexdump looks like this

00 00 00 0A 4D

til the end. Now i want to know if i can convert it back to binary and execute it using a VBScript. I will appreciate any help, thank you.

like image 910
Haytham Mtair Avatar asked Jul 26 '26 14:07

Haytham Mtair


1 Answers

Something like this should work:

hexstr = "00 00 00 0A 4D"

hexarr = Split(hexstr)
ReDim binarr(UBound(hexarr))

For i = 0 To UBound(hexarr)
  binarr(i) = Chr(CInt("&h" & hexarr(i)))
Next

binstr = Join(binarr, "")
like image 99
Ansgar Wiechers Avatar answered Jul 28 '26 06:07

Ansgar Wiechers