Crypt RC4 sample in VBS


Crypt RC4 sample in VBS

Postby John on Fri Jan 03, 2003 4:14 am

"
" Crypt Sample on VBScripting
"

const csCipher_RC4 = 161
" Format Objects
const fmtNone = -1
const fmtCopy = 0
const fmtHEX = 1
const fmtMIME64 = 2
const fmtUU = 3
const fmtXX = 4

" Create the object and Initializes memory
set crypt = createObject("aspCrypt.EasyCrypt")
crypt.Create
MsgBox crypt.Version

message = InputBox("Introduce some text to crypt", "Test", "This is a small test from Visual Basic Script")
password = InputBox("Introduce the password ( seed )", "Passsword", "MyPass")
EnCoded = ""
DeCoded = ""

" Encode in RC4
Crypt.Algorithm = csCipher_RC4
Crypt.Counter( -1 )
Crypt.initKey( password )
EnCoded = Crypt.EnCodeString( message, fmtMIME64 )
TimeEn = Crypt.Counter( 0 )

" Now decode it
Crypt.Counter( -1 )
Crypt.initKey( password )
DeCoded = Crypt.DeCodeString( EnCoded, fmtMIME64 )
TimeDe = Crypt.Counter( 0 )

MsgBox "Encoded in MIME64: "+EnCoded
MsgBox "Decoded again : "+DeCoded

MsgBox "Time for encode: "+TimeEn+", and decoding: " + TimeDe + chr(13) + "Shareware vesion counts the time of the popup nags, so is not a real time, please ignore"
crypt.Destroy
John
 
Posts: 1313
Joined: Wed Oct 31, 2001 10:23 am
Location: Spain

Return to Crypt

Who is online

Users browsing this forum: No registered users and 1 guest

cron

Fatal error: Not able to open ./cache/data_global.php in D:\Hosting\6480136\html\ForosBB3\includes\acm\acm_file.php on line 106