'Encrypt and Decrypt functions '::: This script performs 'RC4' Stream Encryption, and another custom algorithim ::: Dim sbox(255) Dim key(255) Dim strEncrypt, pass, strEnDeCrypt, strCryptVBS strEncrypt = "Eu quero encripitar esta merda!" pass = "funciona" wscript.echo "Encrypt: " & strEncrypt EnDeCrypt strEncrypt, pass wscript.echo "EnCrypted String: " & strEnDeCrypt EnDeCrypt strEnDeCrypt, pass wscript.echo "Done Decrypt: " & strEnDeCrypt Wscript.Echo "Another Method" wscript.echo "Encrypt: " & strEncrypt CryptVBS strEncrypt, pass ' ANOTHER CRYPT DECRYPT Algorithm Wscript.Echo "EnCrypted String: " &strCryptVBS CryptVBS strCryptVBS, pass ' ANOTHER CRYPT DECRYPT Algorithm wscript.echo "Done Decrypt: " & strCryptVBS Sub RC4Initialize(strPwd) '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: '::: This routine called by EnDeCrypt function. Initializes the ::: '::: sbox and the key array) ::: '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: dim tempSwap dim a dim b intLength = len(strPwd) For a = 0 To 255 key(a) = asc(mid(strpwd, (a mod intLength)+1, 1)) sbox(a) = a next b = 0 For a = 0 To 255 'Changed to .vbs b = (b + sbox(a) + key(a)) Mod 256 tempSwap = sbox(a) sbox(a) = sbox(b) sbox(b) = tempSwap a = a + 1 next End Sub Function EnDeCrypt(plaintxt, psw) '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: '::: This routine does all the work. Call it both to ENcrypt ::: '::: and to DEcrypt your data. ::: '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: dim temp, a, i, j, k, cipherby, cipher i = 0 j = 0 RC4Initialize psw For a = 1 To Len(plaintxt) i = (i + 1) Mod 256 j = (j + sbox(i)) Mod 256 temp = sbox(i) sbox(i) = sbox(j) sbox(j) = temp k = sbox((sbox(i) + sbox(j)) Mod 256) cipherby = Asc(Mid(plaintxt, a, 1)) Xor k cipher = cipher & Chr(cipherby) next EnDeCrypt = cipher strEnDeCrypt = EnDeCrypt End Function Function CryptVBS(Text, Key) KeyLen = Len(Key) For i = 1 To Len(Text) KeyPtr = (KeyPtr + 1) Mod KeyLen sTxtChr = Mid(Text, i, 1) wTxtChr = Asc(stxtchr) wKeyChr = Asc(Mid(Key, KeyPtr + 1, 1)) CryptKey = Chr(wTxtChr Xor wKeyChr) hold = hold & CryptKey Next CryptVBS = hold strCryptVBS = CryptVBS End Function wscript.quit