alexz15
Постоялец
- Регистрация
- 3 Окт 2008
- Сообщения
- 394
- Реакции
- 194
- Автор темы
- #1
Вот такой код получается:
Помогите перевести скрипт.as в php:
мне нужно декодировать первый код, и алгоритм декодирования.
Код:
6N9V0ioRnjRbtCVHUamb35WHkaF83dhhtHnetClWySVH2xTHOHnNygnHvC9cnjRbtjY8n5FzGdsHOH980aFZnHVH0SnenIk7kdwLnHVHU5Gj0aWL3Hnen5k5k5k5kHn8n5yBGi982d4ZkSnetSVHUamb35Wj0aWL3Hnen5Ulkjh5OCn8nIyj35w405yL0dJNnjRHt1t1t1t1nHVHUamb35Wh0iuRUSnetCllvC9V0ioz0x91njRWvC9b2fAHOjE8nIwV3dJZnjRHG54ZkxsHvC9RnjR1tjY8n5yL0IoN0aW1njRH3dWh6SWHUxy=vdW705Y8Gd4MkwJV0dFmviV8Gd4MkwJh0dV8G5J8Gxz4vikL0d9h35W705Y8kIw80CW1GdFNGCWV35Jjkxmbvd9zk5k43HWNGxmX0d4BkSWNGxmXG5J8Gxz4nHVH0dFBkNnenI9znHVH3dWMUf9I2xlHOjE8nIu8Gi3HOjYVXTrr
Код:
//class Base64
package com.util
{
import com.uppod.*;
import flash.utils.*;
public class Base64 extends Object
{
public function Base64()
{
super();
throw new Error("Base64 class is static container only");
}
public static function enc_replace_ab(arg1:String, arg2:String, arg3:String):String
{
var loc4:*;
var loc5:*;
loc4 = new RegExp(arg1, "g");
loc5 = new RegExp(arg2, "g");
arg3 = arg3.replace(loc4, "___");
arg3 = arg3.replace(loc5, arg1);
arg3 = arg3.replace(new RegExp("___", "g"), arg2);
return arg3;
}
public static function encode(arg1:String):String
{
var loc2:*;
var loc3:*;
loc2 = new ByteArray();
loc2.writeUTFBytes(arg1);
loc3 = encodeByteArray(loc2);
loc3 = enc_replace(loc3, "e");
return loc3;
}
public static function enc_replace(arg1:String, arg2:String, arg3:Boolean=false):String
{
var loc4:*;
var loc5:*;
var loc6:*;
var loc7:*;
var loc8:*;
var loc9:*;
loc7 = null;
loc8 = null;
loc4 = new ClientGet();
loc5 = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "W", "G", "X", "M", "H", "R", "U", "Z", "I", "D", "=", "N", "Q", "V", "B", "L"];
loc6 = ["b", "z", "a", "c", "l", "m", "e", "p", "s", "J", "x", "d", "f", "t", "i", "o", "Y", "k", "n", "g", "r", "y", "T", "w", "u", "v"];
if (!(loc4.Client == null) && !arg3)
{
if (loc4.Client.codec_a != null)
{
loc5 = loc4.Client.codec_a;
loc6 = loc4.Client.codec_b;
}
}
if (arg2 == "e")
{
loc7 = loc5;
loc8 = loc6;
}
if (arg2 == "d")
{
loc7 = loc6;
loc8 = loc5;
}
loc9 = 0;
while (loc9 < loc7.length)
{
arg1 = enc_replace_ab(loc7[loc9], loc8[loc9], arg1);
++loc9;
}
return arg1;
}
public static function encodeByteArray(arg1:flash.utils.ByteArray):String
{
var loc2:*;
var loc3:*;
var loc4:*;
var loc5:*;
var loc6:*;
var loc7:*;
loc3 = null;
loc5 = 0;
loc6 = 0;
loc7 = 0;
loc2 = "";
loc4 = new Array(4);
arg1.position = 0;
while (arg1.bytesAvailable > 0)
{
loc3 = new Array();
loc5 = 0;
while (loc5 < 3 && arg1.bytesAvailable > 0)
{
loc3[loc5] = arg1.readUnsignedByte();
loc5 = (loc5 + 1);
}
loc4[0] = (loc3[0] & 252) >> 2;
loc4[1] = (loc3[0] & 3) << 4 | loc3[1] >> 4;
loc4[2] = (loc3[1] & 15) << 2 | loc3[2] >> 6;
loc4[3] = loc3[2] & 63;
loc6 = loc3.length;
while (loc6 < 3)
{
loc4[(loc6 + 1)] = 64;
loc6 = (loc6 + 1);
}
loc7 = 0;
while (loc7 < loc4.length)
{
loc2 = loc2 + BASE64_CHARS.charAt(loc4[loc7]);
loc7 = (loc7 + 1);
}
}
return loc2;
}
public static function decode(arg1:String, arg2:Boolean=false):String
{
var loc3:*;
arg1 = enc_replace(arg1, "d", arg2);
loc3 = decodeToByteArray(arg1);
return loc3.readUTFBytes(loc3.length);
}
public static function decodeToByteArray(arg1:String):flash.utils.ByteArray
{
var loc2:*;
var loc3:*;
var loc4:*;
var loc5:*;
var loc6:*;
var loc7:*;
loc6 = 0;
loc7 = 0;
loc2 = new ByteArray();
loc3 = new Array(4);
loc4 = new Array(3);
loc5 = 0;
while (loc5 < arg1.length)
{
loc6 = 0;
while (loc6 < 4 && loc5 + loc6 < arg1.length)
{
loc3[loc6] = BASE64_CHARS.indexOf(arg1.charAt(loc5 + loc6));
loc6 = (loc6 + 1);
}
loc4[0] = (loc3[0] << 2) + ((loc3[1] & 48) >> 4);
loc4[1] = ((loc3[1] & 15) << 4) + ((loc3[2] & 60) >> 2);
loc4[2] = ((loc3[2] & 3) << 6) + loc3[3];
loc7 = 0;
while (loc7 < loc4.length)
{
if (loc3[(loc7 + 1)] == 64)
{
break;
}
loc2.writeByte(loc4[loc7]);
loc7 = (loc7 + 1);
}
loc5 = loc5 + 4;
}
loc2.position = 0;
return loc2;
}
public static const version:String="1.0.0";
private static const BASE64_CHARS:String="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
}
}