• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

AutoIT Encrypt & Decrypt TCP Data

Status
Not open for further replies.

rayane888

LvL-23
User
Joined
Dec 5, 2011
Messages
131
Reputation
0
Reaction score
735
Points
93
Credits
0
‎13 Years of Service‎
44%
Code:
>; Example Usage:

;  Send:   TCPSend($TCPSocket, TCPCrypt(True, $Message))

;  Receive:   $sReceived = TCPCrypt(False, TCPRecv($TCPSocket, 2048))


#Region TCPCrypt Function
Func TCPCrypt($TCPCrypt_Action, $TCPCrypt_Data)
   _Crypt_Startup()
   $TCPCrypt_Key = _Crypt_DeriveKey("YOURsuperSECRETpassKEYforDecryption", $CALG_AES_256)
   If $TCPCrypt_Action = True Then
       $TCPCrypt_Return = _Crypt_EncryptData($TCPCrypt_Data, $TCPCrypt_Key, $CALG_USERKEY)
   Else
       $TCPCrypt_Return = BinaryToString(_Crypt_DecryptData($TCPCrypt_Data, $TCPCrypt_Key, $CALG_USERKEY))
   EndIf
   _Crypt_DestroyKey($TCPCrypt_Key)
   _Crypt_Shutdown()
   Return $TCPCrypt_Return
EndFunc
#EndRegion TCPCrypt Function
 
Status
Not open for further replies.
Back
Top