ka0z Posted March 10, 2013 Report Posted March 10, 2013 This code shows how to make TEA Encryption by legend90Func _XXTEA_Encrypt ( $ Data , $ Key )$ Data = Binary ( $ Data )Local $ datalen = BinaryLen ( $ Data )If $ datalen = 0 Then Return ""ElseIf $ datalen < 8 Then $ Datalen = 8EndIfLocal $ Opcode = ''Local $ CodeBuffer = DllStructCreate ( "byte [" & BinaryLen ( $ Opcode ) & "]" )DllStructSetData ( $ CodeBuffer , 1 , $ Opcode )Local $ V = DllStructCreate ( "byte [" & Ceiling ( $ datalen / 4 ) * 4 & "]" )DllStructSetData ( $ V , 1 , $ Data )Local $ K = DllStructCreate ( "byte [16]" )DllStructSetData ( $ K , 1 , $ Key )DllCall ( "user32.dll" , "none" , "CallWindowProc" , "ptr" , DllStructGetPtr ( $ CodeBuffer ) , _ "Ptr" , DllStructGetPtr ( $ V ) , _ "Int" , Ceiling ( $ datalen / 4 ) , _ "Ptr" , DllStructGetPtr ( $ K ) , _ "Int" , 0 )Local $ Ret = DllStructGetData ( $ V , 1 )$ CodeBuffer = 0$ V = 0$ K = 0Return $ RetEndFuncFunc _XXTEA_Decrypt ( $ Data , $ Key )$ Data = Binary ( $ Data )Local $ datalen = BinaryLen ( $ Data )If $ datalen = 0 Then Return ""Local $ Opcode = ''Local $ CodeBuffer = DllStructCreate ( "byte [" & BinaryLen ( $ Opcode ) & "]" )DllStructSetData ( $ CodeBuffer , 1 , $ Opcode )Local $ V = DllStructCreate ( "byte [" & Ceiling ( $ datalen / 4 ) * 4 & "]" )DllStructSetData ( $ V , 1 , $ Data )Local $ K = DllStructCreate ( "byte [16]" )DllStructSetData ( $ K , 1 , $ Key )DllCall ( "user32.dll" , "none" , "CallWindowProc" , "ptr" , DllStructGetPtr ( $ CodeBuffer ) , _ "Ptr" , DllStructGetPtr ( $ V ) , _ "Int" , Ceiling ( $ datalen / 4 ) , _ "Ptr" , DllStructGetPtr ( $ K ) , _ "Int" , 0 )Local $ Ret = DllStructGetData ( $ V , 1 )$ CodeBuffer = 0$ V = 0$ K = 0Return $ RetEndFunc Quote