EndGame2013 Posted November 6, 2011 Share Posted November 6, 2011 why not? $sString = "Now is the time for all good men to come to the aid of their country." $sKey = "This is my key phrase." $sCrypt = rc4($sKey, $sString) $sString = rc4($sKey, $sCrypt) STRING: BinaryToString($sString) $bh = StringToBinary($sString) $reString = rc4($sKey, $bh) Why $reString <> $sString? Try this: $sData = "Now is the time for all good men to come to the aid of their country." $sKey = "This is my key phrase." $bCrypt = rc4($sKey, $sData) $bDcrypt = rc4($sKey, $bCrypt) $sDcrypt = BinaryToString($bDcrypt) $bData = StringToBinary($sDcrypt) $reCrypt = rc4($sKey, $bData) $srecrypt = BinaryToString(rc4($sKey, $recrypt)) ConsoleWrite($sData&@CRLF&$sKey&@CRLF&$bCrypt&@CRLF&$bDcrypt&@CRLF&$sDcrypt&@CRLF&$bData&@CRLF&$reCrypt&@CRLF&$srecrypt) Link to comment Share on other sites More sharing options...
Chimaera Posted November 6, 2011 Share Posted November 6, 2011 (edited) Quick question if i may I have a feedback form i was going to use the smtp mailer by Jos for sending the form to a mail address is this code sufficient to keep the email password relativily safe? expandcollapse popup$sString = "Now is the time for all good men to come to the aid of their country." ; plain string $sKey = "This is my key phrase." $sCrypt = rc4($sKey, $sString) ; encrypted binary ConsoleWrite("Debug: $sCrypt = " & $sCrypt & @LF) $sString = rc4($sKey, $sCrypt) ; decrypted binary ConsoleWrite("Debug: $sString = " & $sString & @LF) $sString = BinaryToString($sString) ; plain string ConsoleWrite("Debug: $sString = " & $sString & @LF) $bh = StringToBinary($sString) ; plain binary ConsoleWrite("Debug: $bh = " & $bh & @LF) $reString = rc4($sKey, $bh) ; encrypted binary ConsoleWrite("Debug: $reString = " & $reString & @LF) $reString = rc4($sKey, $reString) ; decrypted binary ConsoleWrite("Debug: $reString = " & $reString & @LF) $reString = BinaryToString($reString) ; plain string ConsoleWrite("Debug: $reString = " & $reString & @LF) ; ------------------------------------------------------- ; Function: rc4 ; Purpose: An encryption/decryption RC4 implementation in AutoIt ; Syntax: rc4($key, $value) ; Where: $key = encrypt/decrypt key ; $value = value to be encrypted/decrypted ; On success returns encrypted/decrypted version of $value ; Author: SkinnyWhiteGuy on the AutoIt forums at www.autoitscript.com/forum ; Notes: The same function encrypts and decrypts $value. ; ------------------------------------------------------- Func rc4($key, $value) Local $S[256], $i, $j, $c, $t, $x, $y, $output Local $keyLength = BinaryLen($key), $valLength = BinaryLen($value) For $i = 0 To 255 $S[$i] = $i Next For $i = 0 To 255 $j = Mod($j + $S[$i] + Dec(StringTrimLeft(BinaryMid($key, Mod($i, $keyLength) + 1, 1), 2)), 256) $t = $S[$i] $S[$i] = $S[$j] $S[$j] = $t Next For $i = 1 To $valLength $x = Mod($x + 1, 256) $y = Mod($S[$x] + $y, 256) $t = $S[$x] $S[$x] = $S[$y] $S[$y] = $t $j = Mod($S[$x] + $S[$y], 256) $c = BitXOR(Dec(StringTrimLeft(BinaryMid($value, $i, 1), 2)), $S[$j]) $output = Binary($output) & Binary('0x' & Hex($c, 2)) Next Return $output EndFunc ;==>rc4 Edited November 6, 2011 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
JohnOne Posted November 6, 2011 Share Posted November 6, 2011 Try this: $sData = "Now is the time for all good men to come to the aid of their country." $sKey = "This is my key phrase." $bCrypt = rc4($sKey, $sData) $bDcrypt = rc4($sKey, $bCrypt) $sDcrypt = BinaryToString($bDcrypt) $bData = StringToBinary($sDcrypt) $reCrypt = rc4($sKey, $bData) $srecrypt = BinaryToString(rc4($sKey, $recrypt)) ConsoleWrite($sData&@CRLF&$sKey&@CRLF&$bCrypt&@CRLF&$bDcrypt&@CRLF&$sDcrypt&@CRLF&$bData&@CRLF&$reCrypt&@CRLF&$srecrypt) Yes, because I'm sure the OP is still having trouble with this 4 years later. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Zedna Posted November 6, 2011 Share Posted November 6, 2011 (edited) Just for reference: In latest Autoit is standard Crypt UDF which use system crypting There is also RC4 algoritmus available ($CALG_RC4) #Include <Crypt.au3> _Crypt_EncryptData($vData, $vCryptKey, $iALG_ID[, $fFinal = True]) _Crypt_DecryptData($vData, $vCryptKey, $iALG_ID[, $fFinal = True]) Edited November 6, 2011 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now