Page 1 of 1

Want to learn how to encrypt batch file with ACII coding....

Posted: 21 Oct 2010 18:22
by derek.hansen
ok so I just found out about ascii coding and I kind of get it but not really...this is from aGerman jsut copied and pasted it but don't really get exactly how it works at all.....



set /a n=0
:loop
set "hex=!encrypted:~%n%,2!"
if "%hex%"=="" goto exitLoop
set "hex=%hex:~-1%%hex:~,1%"
set /a dec=0x%hex%
cmd /c exit %dec%
set "string=%=exitcodeascii%%string%"
set /a n+=2
goto :loop

:exitLoop
echo\!string!
pause>nul

wondering if someone could explain it to me in lamence terms...

Re: Want to learn how to encrypt batch file with ACII coding

Posted: 21 Oct 2010 20:03
by ghostmachine4
derek.hansen wrote:ok so I just found out about ascii coding and I kind of get it but not really...this is from aGerman jsut copied and pasted it but don't really get exactly how it works at all.....



set /a n=0
:loop
set "hex=!encrypted:~%n%,2!"
if "%hex%"=="" goto exitLoop
set "hex=%hex:~-1%%hex:~,1%"
set /a dec=0x%hex%
cmd /c exit %dec%
set "string=%=exitcodeascii%%string%"
set /a n+=2
goto :loop

:exitLoop
echo\!string!
pause>nul

wondering if someone could explain it to me in lamence terms...


don't fret yourself with ugly and unreadable batch code. If you can, download and use a programming language, such as Python/Perl etc.. If not, you can use native vbscript. To get a Hex number,

Code: Select all

MyHex = Hex(459)
Wscript.Echo MyHex

To get ascii character

Code: Select all

MyChar = Chr(65) 'returns A


To get Ascii code of a character

Code: Select all

MyNumber = Asc("A") 'returns 65


simple as that.