In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Hash String

Get Adobe Flash player
by jangins101 17 Jan 2012
    Embed
package {
    import flash.trace.Trace;
    import flash.display.*;
    import flash.events.*;
    import flash.text.*;
    import flash.ui.*;
    import flash.events.*;
    import com.adobe.utils.*;
    import flash.utils.*;
    import flash.text.TextField;
    import flash.text.TextFieldType;

    
    [SWF(backgroundColor="#ffffff", frameRate=20)]
    public class FlashTest extends Sprite {
        public var lblId:TextField;
        public var txtId:TextField;
        
        public var lblToken:TextField;
        public var txtToken:TextField;
        
        public var lblAction:TextField;
        public var txtAction:TextField;
        
        public var lblParams:TextField;
        public var txtParams:TextField;
        
        public var txtOutput:TextField;        
        public var button:Sprite;    
        
        public var yStart:int = 10;    

        public function FlashTest() {        
            
            // ID    
            lblId = new TextField();
            lblId.x = 20;
            lblId.y = yStart;
            lblId.width = stage.stageWidth - 20;
            lblId.height = 20;
            lblId.text = "DG User ID:";
            stage.addChild(lblId);
            yStart = yStart + lblId.height;
            
            txtId = new TextField();
            txtId.border = true;
            txtId.x = 20;
            txtId.y = yStart;
            txtId.width = stage.stageWidth - 30;
            txtId.height = 20;
            txtId.text = "392133";
            txtId.type = TextFieldType.INPUT;
            stage.addChild(txtId);
            yStart = yStart + txtId.height;
            
            // Token
            lblToken = new TextField();
            lblToken.x = 20;
            lblToken.y = yStart;
            lblToken.width = stage.stageWidth - 20;
            lblToken.height = 20;
            lblToken.text = "Token:";
            stage.addChild(lblToken);
            yStart = yStart + lblToken.height;
            
            txtToken = new TextField();
            txtToken.border = true;
            txtToken.x = 20;
            txtToken.y = yStart;
            txtToken.width = stage.stageWidth - 30;
            txtToken.height = 20;
            txtToken.text = "ADuBfyBNaBPGNI6fSlxRGtiHakPWEIZG";
            txtToken.type = TextFieldType.INPUT;
            stage.addChild(txtToken);
            yStart = yStart + txtToken.height;
            
            // Action            
            lblAction = new TextField();
            lblAction.x = 20;
            lblAction.y = yStart;
            lblAction.width = stage.stageWidth - 20;
            lblAction.height = 20;
            lblAction.text = "Action:";
            stage.addChild(lblAction);
            yStart = yStart + lblAction.height;
            
            txtAction = new TextField();
            txtAction.border = true;
            txtAction.x = 20;
            txtAction.y = yStart;
            txtAction.width = stage.stageWidth - 30;
            txtAction.height = 20;
            txtAction.text = "";
            txtAction.type = TextFieldType.INPUT;
            stage.addChild(txtAction);
            yStart = yStart + txtAction.height;
            
            // Parameters
            lblParams = new TextField();
            lblParams.x = 20;
            lblParams.y = yStart;
            lblParams.width = stage.stageWidth - 20;
            lblParams.height = 20;
            lblParams.text = "Parameters:";
            stage.addChild(lblParams);
            yStart = yStart + lblParams.height;
            
            txtParams = new TextField();
            txtParams.border = true;
            txtParams.x = 20;
            txtParams.y = yStart;
            txtParams.width = stage.stageWidth - 30;
            txtParams.height = 20;
            txtParams.text = "";
            txtParams.type = TextFieldType.INPUT;
            stage.addChild(txtParams);
            yStart = yStart + txtParams.height + 5;
            
            // Button
            button = new Sprite();
            button.graphics.lineStyle(1, 0xBBBBBB);
            button.graphics.beginFill(0xEEEEEE);
            button.graphics.drawRoundRect(0, 0, 100, 20, 5, 5);
            button.graphics.endFill();
            button.x = 20;
            button.y = yStart;
            button.mouseChildren = false;
            button.buttonMode = true;
            button.addEventListener(MouseEvent.CLICK, buttton_Click);
            var field:TextField = new TextField();
                field.width = 100;
                field.height = 20;
                field.htmlText = "<p align='center'><font face='_sans'>Build It!</span></p>";         
            button.addChild(field);
            stage.addChild(button);
            yStart = yStart + button.height;
            
            // Output
            txtOutput = new TextField();
            txtOutput.x = 20;
            txtOutput.y = yStart;
            txtOutput.width = stage.stageWidth - 20;
            txtOutput.height = 300;
            txtOutput.wordWrap = true;
            txtOutput.text = "";
            stage.addChild(txtOutput);   
            yStart = yStart + txtOutput.height;            

            // Event Listeners
            stage.addEventListener(Event.ENTER_FRAME, loop);
        }

        private var conn:Connection = null;
        private function buttton_Click(e:Event):void {            
            conn = new Connection(txtId.text, txtToken.text);   
            var ret:String = conn.callService("CollectDailyRewards", {});
            txtOutput.text = "SigString: " + conn.sigString + "\n" + "Sig: " + conn.signature + "\n" + "URL: " + conn.url;
            return;
            
            var ngid:String = "286051";            
            var sReturn:String = visitAnyone(ngid);
            txtOutput.text = sReturn;
            return;
            
            var name:String = txtString.text;
            var hash:String = MD5.hash(name);
            txtOutput.text = hash;
        }

        private function loop(e:Event):void {}
        
        
        private function visitAnyone(ngid:String) : String {
            txtOutput.text = "v1";
            var ret:String = conn.callService("CollectDailyRewards", {});
            //var ret:String = conn.callService("VisitNeighbor", {neighbor_dcgid:ngid});
            txtOutput.text = "v2";
            //this.getServer().serverCallServiceWithParameters(ServiceIDs.VISIT_NEIGHBOR, {neighbor_dcgid:param1}, true);
            return ret;
        }
    
   }    
}

internal class Connection extends Object {
    
    public var sigString:String = "";
    public var signature:String = "";
    public var url:String = "";
    
    private var rootUrl:String = "https://google.zombielane.com/dead/";
    private var userId:String;
    private var token:String;
    private var today:Date;
    private var counter:int = 1;
    
    public function Connection(uid:String, token:String) {
        this.userId = uid;
        this.token = token;
        this.today = new Date(); 
    }
    
    public function callService(action:String, parameters:Object) : String
    {
        var key :String       = null;
        var callback:String   = "call_" + this.counter;
        var request:Object    = {};
            request           = parameters;
            request.dcgid     = this.userId;
            request.service   = action;
            request.call_id   = callback;
            request.platform  = "7";             //PlatformManager.getPlatform();
            request.time      = this.today.getTime() + getTimer();
            request.sig       = this.createSignature(request);
            request.retryCount= 0;
        var url:String = ""
        var ary:Array = new Array();
        var item:Object = null;
                
        for each (key in request)
            { ary.push({key:ary, value:request[ary]}); } 
            
        for each (item in ary)
            { url = url + item.key + "=" + item.value; }
        
        this.signature = request.sig;
        this.url = getUrl(action, request);
        return this.url;
    }

    private function createSignature(param1:Object) : String {
        var _loc_4:String = null;
        var _loc_5:int = 0;
        var _loc_6:Object = null;
        var _loc_2:String = "";
        var _loc_3:* = new Array();
        for (_loc_4 in param1){
            
            _loc_3.push({key:_loc_4, value:param1[_loc_4]});
        }
        _loc_3.sortOn("key", Array.CASEINSENSITIVE);
        _loc_5 = 0;
        for each (_loc_6 in _loc_3){
            
            _loc_2 = _loc_2 + _loc_6.key + "=" + _loc_6.value;
            if (_loc_5 < (_loc_3.length - 1)){
                _loc_2 = _loc_2 + "&";
            }
            _loc_5++;
        }
        _loc_2 = _loc_2 + this.token;
        _loc_2 = _loc_2 + "PreCr4c4";
        
        this.sigString = _loc_2;
       
        return MD5.hash(_loc_2);
    } 
    
    private function getUrl(param0:String, param1:Object) : String {
        var _loc_4:String = null;
        var _loc_5:int = 0;
        var _loc_6:Object = null;
        var _loc_2:String = "";
        var _loc_3:* = new Array();
        for (_loc_4 in param1){
            
            _loc_3.push({key:_loc_4, value:param1[_loc_4]});
        }
        
        _loc_5 = 0;
        for each (_loc_6 in _loc_3){
            
            _loc_2 = _loc_2 + _loc_6.key + "=" + _loc_6.value;
            if (_loc_5 < (_loc_3.length - 1)){
                _loc_2 = _loc_2 + "&";
            }
            _loc_5++;
        }
        
        return rootUrl + param0 + "?" + _loc_2;
    }
}


import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.ui.*;
import flash.events.*;
import com.adobe.utils.*;
import flash.utils.*;
import flash.text.TextField;
import flash.text.TextFieldType;
internal class MD5 extends Object
{
    public static var digest:ByteArray;
    
    public function MD5(): void {}

    private static function ff(param1:int, param2:int, param3:int, param4:int, param5:int, param6:int, param7:int) : int
    {
        return transform(f, param1, param2, param3, param4, param5, param6, param7);
    }// end function

    private static function f(param1:int, param2:int, param3:int) : int
    {
        return param1 & param2 | ~param1 & param3;
    }// end function

    private static function g(param1:int, param2:int, param3:int) : int
    {
        return param1 & param3 | param2 & ~param3;
    }// end function

    private static function h(param1:int, param2:int, param3:int) : int
    {
        return param1 ^ param2 ^ param3;
    }// end function

    private static function i(param1:int, param2:int, param3:int) : int
    {
        return param2 ^ (param1 | ~param3);
    }// end function

    private static function transform(param1:Function, param2:int, param3:int, param4:int, param5:int, param6:int, param7:int, param8:int) : int
    {
        var _loc_9:* = param2 + int(param1(param3, param4, param5)) + param6 + param8;
        return IntUtil.rol(_loc_9, param7) + param3;
    }// end function

    private static function hh(param1:int, param2:int, param3:int, param4:int, param5:int, param6:int, param7:int) : int
    {
        return transform(h, param1, param2, param3, param4, param5, param6, param7);
    }// end function

    public static function hash(param1:String) : String
    {
        var _loc_2:* = new ByteArray();
        _loc_2.writeUTFBytes(param1);
        return hashBinary(_loc_2);
    }// end function

    private static function createBlocks(param1:ByteArray) : Array
    {
        var _loc_2:* = new Array();
        var _loc_3:* = param1.length * 8;
        var _loc_4:int = 255;
        var _loc_5:int = 0;
        while (_loc_5 < _loc_3)
        {
            
            _loc_2[int(_loc_5 >> 5)] = _loc_2[int(_loc_5 >> 5)] | (param1[_loc_5 / 8] & _loc_4) << _loc_5 % 32;
            _loc_5 = _loc_5 + 8;
        }
        _loc_2[int(_loc_3 >> 5)] = _loc_2[int(_loc_3 >> 5)] | 128 << _loc_3 % 32;
        _loc_2[int((_loc_3 + 64 >>> 9 << 4) + 14)] = _loc_3;
        return _loc_2;
    }// end function

    public static function hashBinary(param1:ByteArray) : String
    {
        var _loc_6:int = 0;
        var _loc_7:int = 0;
        var _loc_8:int = 0;
        var _loc_9:int = 0;
        var _loc_2:int = 1732584193;
        var _loc_3:int = -271733879;
        var _loc_4:int = -1732584194;
        var _loc_5:int = 271733878;
        var _loc_10:* = createBlocks(param1);
        var _loc_11:* = createBlocks(param1).length;
        var _loc_12:int = 0;
        while (_loc_12 < _loc_11)
        {
            
            _loc_6 = _loc_2;
            _loc_7 = _loc_3;
            _loc_8 = _loc_4;
            _loc_9 = _loc_5;
            _loc_2 = ff(_loc_2, _loc_3, _loc_4, _loc_5, _loc_10[int(_loc_12 + 0)], 7, -680876936);
            _loc_5 = ff(_loc_5, _loc_2, _loc_3, _loc_4, _loc_10[int((_loc_12 + 1))], 12, -389564586);
            _loc_4 = ff(_loc_4, _loc_5, _loc_2, _loc_3, _loc_10[int(_loc_12 + 2)], 17, 606105819);
            _loc_3 = ff(_loc_3, _loc_4, _loc_5, _loc_2, _loc_10[int(_loc_12 + 3)], 22, -1044525330);
            _loc_2 = ff(_loc_2, _loc_3, _loc_4, _loc_5, _loc_10[int(_loc_12 + 4)], 7, -176418897);
            _loc_5 = ff(_loc_5, _loc_2, _loc_3, _loc_4, _loc_10[int(_loc_12 + 5)], 12, 1200080426);
            _loc_4 = ff(_loc_4, _loc_5, _loc_2, _loc_3, _loc_10[int(_loc_12 + 6)], 17, -1473231341);
            _loc_3 = ff(_loc_3, _loc_4, _loc_5, _loc_2, _loc_10[int(_loc_12 + 7)], 22, -45705983);
            _loc_2 = ff(_loc_2, _loc_3, _loc_4, _loc_5, _loc_10[int(_loc_12 + 8)], 7, 1770035416);
            _loc_5 = ff(_loc_5, _loc_2, _loc_3, _loc_4, _loc_10[int(_loc_12 + 9)], 12, -1958414417);
            _loc_4 = ff(_loc_4, _loc_5, _loc_2, _loc_3, _loc_10[int(_loc_12 + 10)], 17, -42063);
            _loc_3 = ff(_loc_3, _loc_4, _loc_5, _loc_2, _loc_10[int(_loc_12 + 11)], 22, -1990404162);
            _loc_2 = ff(_loc_2, _loc_3, _loc_4, _loc_5, _loc_10[int(_loc_12 + 12)], 7, 1804603682);
            _loc_5 = ff(_loc_5, _loc_2, _loc_3, _loc_4, _loc_10[int(_loc_12 + 13)], 12, -40341101);
            _loc_4 = ff(_loc_4, _loc_5, _loc_2, _loc_3, _loc_10[int(_loc_12 + 14)], 17, -1502002290);
            _loc_3 = ff(_loc_3, _loc_4, _loc_5, _loc_2, _loc_10[int(_loc_12 + 15)], 22, 1236535329);
            _loc_2 = gg(_loc_2, _loc_3, _loc_4, _loc_5, _loc_10[int((_loc_12 + 1))], 5, -165796510);
            _loc_5 = gg(_loc_5, _loc_2, _loc_3, _loc_4, _loc_10[int(_loc_12 + 6)], 9, -1069501632);
            _loc_4 = gg(_loc_4, _loc_5, _loc_2, _loc_3, _loc_10[int(_loc_12 + 11)], 14, 643717713);
            _loc_3 = gg(_loc_3, _loc_4, _loc_5, _loc_2, _loc_10[int(_loc_12 + 0)], 20, -373897302);
            _loc_2 = gg(_loc_2, _loc_3, _loc_4, _loc_5, _loc_10[int(_loc_12 + 5)], 5, -701558691);
            _loc_5 = gg(_loc_5, _loc_2, _loc_3, _loc_4, _loc_10[int(_loc_12 + 10)], 9, 38016083);
            _loc_4 = gg(_loc_4, _loc_5, _loc_2, _loc_3, _loc_10[int(_loc_12 + 15)], 14, -660478335);
            _loc_3 = gg(_loc_3, _loc_4, _loc_5, _loc_2, _loc_10[int(_loc_12 + 4)], 20, -405537848);
            _loc_2 = gg(_loc_2, _loc_3, _loc_4, _loc_5, _loc_10[int(_loc_12 + 9)], 5, 568446438);
            _loc_5 = gg(_loc_5, _loc_2, _loc_3, _loc_4, _loc_10[int(_loc_12 + 14)], 9, -1019803690);
            _loc_4 = gg(_loc_4, _loc_5, _loc_2, _loc_3, _loc_10[int(_loc_12 + 3)], 14, -187363961);
            _loc_3 = gg(_loc_3, _loc_4, _loc_5, _loc_2, _loc_10[int(_loc_12 + 8)], 20, 1163531501);
            _loc_2 = gg(_loc_2, _loc_3, _loc_4, _loc_5, _loc_10[int(_loc_12 + 13)], 5, -1444681467);
            _loc_5 = gg(_loc_5, _loc_2, _loc_3, _loc_4, _loc_10[int(_loc_12 + 2)], 9, -51403784);
            _loc_4 = gg(_loc_4, _loc_5, _loc_2, _loc_3, _loc_10[int(_loc_12 + 7)], 14, 1735328473);
            _loc_3 = gg(_loc_3, _loc_4, _loc_5, _loc_2, _loc_10[int(_loc_12 + 12)], 20, -1926607734);
            _loc_2 = hh(_loc_2, _loc_3, _loc_4, _loc_5, _loc_10[int(_loc_12 + 5)], 4, -378558);
            _loc_5 = hh(_loc_5, _loc_2, _loc_3, _loc_4, _loc_10[int(_loc_12 + 8)], 11, -2022574463);
            _loc_4 = hh(_loc_4, _loc_5, _loc_2, _loc_3, _loc_10[int(_loc_12 + 11)], 16, 1839030562);
            _loc_3 = hh(_loc_3, _loc_4, _loc_5, _loc_2, _loc_10[int(_loc_12 + 14)], 23, -35309556);
            _loc_2 = hh(_loc_2, _loc_3, _loc_4, _loc_5, _loc_10[int((_loc_12 + 1))], 4, -1530992060);
            _loc_5 = hh(_loc_5, _loc_2, _loc_3, _loc_4, _loc_10[int(_loc_12 + 4)], 11, 1272893353);
            _loc_4 = hh(_loc_4, _loc_5, _loc_2, _loc_3, _loc_10[int(_loc_12 + 7)], 16, -155497632);
            _loc_3 = hh(_loc_3, _loc_4, _loc_5, _loc_2, _loc_10[int(_loc_12 + 10)], 23, -1094730640);
            _loc_2 = hh(_loc_2, _loc_3, _loc_4, _loc_5, _loc_10[int(_loc_12 + 13)], 4, 681279174);
            _loc_5 = hh(_loc_5, _loc_2, _loc_3, _loc_4, _loc_10[int(_loc_12 + 0)], 11, -358537222);
            _loc_4 = hh(_loc_4, _loc_5, _loc_2, _loc_3, _loc_10[int(_loc_12 + 3)], 16, -722521979);
            _loc_3 = hh(_loc_3, _loc_4, _loc_5, _loc_2, _loc_10[int(_loc_12 + 6)], 23, 76029189);
            _loc_2 = hh(_loc_2, _loc_3, _loc_4, _loc_5, _loc_10[int(_loc_12 + 9)], 4, -640364487);
            _loc_5 = hh(_loc_5, _loc_2, _loc_3, _loc_4, _loc_10[int(_loc_12 + 12)], 11, -421815835);
            _loc_4 = hh(_loc_4, _loc_5, _loc_2, _loc_3, _loc_10[int(_loc_12 + 15)], 16, 530742520);
            _loc_3 = hh(_loc_3, _loc_4, _loc_5, _loc_2, _loc_10[int(_loc_12 + 2)], 23, -995338651);
            _loc_2 = ii(_loc_2, _loc_3, _loc_4, _loc_5, _loc_10[int(_loc_12 + 0)], 6, -198630844);
            _loc_5 = ii(_loc_5, _loc_2, _loc_3, _loc_4, _loc_10[int(_loc_12 + 7)], 10, 1126891415);
            _loc_4 = ii(_loc_4, _loc_5, _loc_2, _loc_3, _loc_10[int(_loc_12 + 14)], 15, -1416354905);
            _loc_3 = ii(_loc_3, _loc_4, _loc_5, _loc_2, _loc_10[int(_loc_12 + 5)], 21, -57434055);
            _loc_2 = ii(_loc_2, _loc_3, _loc_4, _loc_5, _loc_10[int(_loc_12 + 12)], 6, 1700485571);
            _loc_5 = ii(_loc_5, _loc_2, _loc_3, _loc_4, _loc_10[int(_loc_12 + 3)], 10, -1894986606);
            _loc_4 = ii(_loc_4, _loc_5, _loc_2, _loc_3, _loc_10[int(_loc_12 + 10)], 15, -1051523);
            _loc_3 = ii(_loc_3, _loc_4, _loc_5, _loc_2, _loc_10[int((_loc_12 + 1))], 21, -2054922799);
            _loc_2 = ii(_loc_2, _loc_3, _loc_4, _loc_5, _loc_10[int(_loc_12 + 8)], 6, 1873313359);
            _loc_5 = ii(_loc_5, _loc_2, _loc_3, _loc_4, _loc_10[int(_loc_12 + 15)], 10, -30611744);
            _loc_4 = ii(_loc_4, _loc_5, _loc_2, _loc_3, _loc_10[int(_loc_12 + 6)], 15, -1560198380);
            _loc_3 = ii(_loc_3, _loc_4, _loc_5, _loc_2, _loc_10[int(_loc_12 + 13)], 21, 1309151649);
            _loc_2 = ii(_loc_2, _loc_3, _loc_4, _loc_5, _loc_10[int(_loc_12 + 4)], 6, -145523070);
            _loc_5 = ii(_loc_5, _loc_2, _loc_3, _loc_4, _loc_10[int(_loc_12 + 11)], 10, -1120210379);
            _loc_4 = ii(_loc_4, _loc_5, _loc_2, _loc_3, _loc_10[int(_loc_12 + 2)], 15, 718787259);
            _loc_3 = ii(_loc_3, _loc_4, _loc_5, _loc_2, _loc_10[int(_loc_12 + 9)], 21, -343485551);
            _loc_2 = _loc_2 + _loc_6;
            _loc_3 = _loc_3 + _loc_7;
            _loc_4 = _loc_4 + _loc_8;
            _loc_5 = _loc_5 + _loc_9;
            _loc_12 = _loc_12 + 16;
        }
        digest = new ByteArray();
        digest.writeInt(_loc_2);
        digest.writeInt(_loc_3);
        digest.writeInt(_loc_4);
        digest.writeInt(_loc_5);
        digest.position = 0;
        return IntUtil.toHex(_loc_2) + IntUtil.toHex(_loc_3) + IntUtil.toHex(_loc_4) + IntUtil.toHex(_loc_5);
    }// end function

    private static function gg(param1:int, param2:int, param3:int, param4:int, param5:int, param6:int, param7:int) : int
    {
        return transform(g, param1, param2, param3, param4, param5, param6, param7);
    }// end function

    private static function ii(param1:int, param2:int, param3:int, param4:int, param5:int, param6:int, param7:int) : int
    {
        return transform(i, param1, param2, param3, param4, param5, param6, param7);
    }// end function

    public static function hashBytes(param1:ByteArray) : String
    {
        return hashBinary(param1);
    }// end function
}