Sorry, i dont know what you're doing but the code i provided works, not beeing anything else that a pure php implementation of the tea-decrypt algorithm, exactly like the DecodeTEA(AVal *key, AVal *text) from rtmp.c.
Remember that before make de tea-decription you need to transform the r2-string to make it hex-number:
Code:
function transform_r2($r2)
{
$_local2 = "";
$_local3 = 0;
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMabcdefghijklmnopqrstuvwxyzabcdefghijklm";
while ($_local3 < strlen($r2))
{
$_local5 = $r2[$_local3];
if (strpos($chars,$_local5) or $_local5=="A")
{
$_local5 = $chars[strpos($chars,$_local5) + 13];
}
$_local2.= $_local5;
$_local3++;
}
return $_local2;
}
I've just implemented the code in rtmp.c and now it's compiled and throwing the right response, but there is some pings i must resolve.
C code for transposition
Code:
int local8,local3,r2size;
char *chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMabcdefghijklmnopqrstuvwxyzabcdefghijklm";
char *local6 = text;
r2size = strlen(local6);
char local2[r2size];
local3 = 0;
while (local3 < r2size)
{
local8 = local6[local3];
char *b = strchr (chars, local8);
int pos = pos ? b - chars : -1;
if (pos>-1)
{local8=chars[pos + 13];}
char local52[2];
memcpy( local52, &local8, 1 );
local2[local3]=local52[0];
local3++;
}
memcpy(text, local2, r2size);:cool:
