Skip to content

Instantly share code, notes, and snippets.

@wodim
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wodim/19889bffcad52f018f56 to your computer and use it in GitHub Desktop.
Save wodim/19889bffcad52f018f56 to your computer and use it in GitHub Desktop.
package
{
import com.hurlant.util.Base64;
import com.hurlant.crypto.symmetric.AESKey;
import flash.utils.*;
public class Tester {
public function descifra_ip(cookie:String, claveCifrado:String) : String {
var t:ByteArray = Base64.decodeToByteArray(cookie);
var k:ByteArray = Base64.decodeToByteArray(claveCifrado);
var v:ByteArray = new ByteArray();
var v2:ByteArray = new ByteArray();
var v3:ByteArray = new ByteArray();
var r:ByteArray = new ByteArray();
k.position = 24;
k.writeBytes(t,0,8);
v.writeBytes(t,8,16);
k.position = 0;
v.position = 0;
var aes:AESKey = new AESKey(k);
var i:int = 8;
while(i < t.length)
{
v.position = 0;
v2.position = 0;
v3.position = 0;
v.writeBytes(t,i,16);
v3.writeBytes(v,0,16);
aes.decrypt(v);
this.xor(v,v2);
v2.writeBytes(v3,0,16);
r.writeBytes(v,0,16);
i = i + 16;
}
aes.dispose();
var resultado:String = r.toString();
return resultado;
}
public function xor(destino:ByteArray, origen:ByteArray) : void {
var i:int = 0;
while(i < destino.length)
{
destino[i] = destino[i] ^ origen[i];
i++;
}
}
}
}
var tester:Tester = new Tester();
var output:String = tester.descifra_ip("93xJGQfvBp6tuYJogOfZoFgPRvvltNLaiZurZKTgi7QWHgTcIcWZCs5Q67Lu1Gv[Q4cfRnPczC5GhN[10bO09yjKYU2sBKR9FAaxuJQVfuEYDs4IJPSGy[5b8Fg1sH]wHaTI3BlyzaQ=", "DKAE2jDQUpC4AvQgqTDRaniTBQCiMrDE1aNUBIuSnWCg");
trace(output);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment