public static function Read(param1:IDataInput) : int
{
var _loc2_:* = 0;
var _loc3_:int = param1.readUnsignedByte();
var _loc4_:* = (_loc3_ & 64) != 0;
var _loc5_:int = 6;
_loc2_ = _loc3_ & 63;
while(_loc3_ & 128)
{
_loc3_ = param1.readUnsignedByte();
_loc2_ = _loc2_ | (_loc3_ & 127) << _loc5_;
_loc5_ = _loc5_ + 7;
}
if(_loc4_)
{
_loc2_ = int(-_loc2_);
}
return _loc2_;
}
someone can help me with write thing? about to use in as3 server based but got only read thing
As @Organis correctly said "there's no telling how to compose a reverted algorithm."
The only obvious things are listed below, so you'll have to do a lot of testing to get it right (that's how reverse engineering works, and it might take days or weeks). Good luck.
Assessment:
(1)
Look like it expects a (byte) array with two entries. I suspect you should write a Short (in hex formnat) but it'll be easier to just write two separate decimal values (since a
Shortis a value that spreads over two bytes).As for the
Readside...Since the function returns a value to update some var, you should use as:
Where
myResultgets the function's returned_loc2_result.(2)
This will give either a
0or64. Is0if lower than 64, or else is64if equal or higher. This is likely a quick shortcut to setting aBooleanlike:(3)
Where
_loc2_is set as an integer of either0or63.(4)
I don't know what this is trying to achieve.
(_loc3_ & 128)is either0or128. ThisWhile(0)orWhile(128)loop will run forever and there isn't any stoppingbreak;at the end.(5)
This updates
_loc2_with two values. The current loc2 value is combined with a modified loc3 value.(6)
Likely means
if( _loc4_ == true )...