' encodefile.vbs
'
' Hex-encodes a binary file.
'
' Copyright (C) 2009 Ryan O'Horo www.cravediy.com
' This program is free software; you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation; either version 2 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU General Public License for more details.
'

Set fso = CreateObject("Scripting.FileSystemObject")

Set fin = fso.OpenTextFile("hello.exe", 1)
Set fout = fso.OpenTextFile("hexencoded.txt", 2, True)
Do Until fin.AtEndOfStream
	fout.Write Right("0" + Hex(Asc(fin.Read(1))),2)
Loop
fin.Close
fout.Close

MsgBox "Completed"