Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7919419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:51:28+00:00 2026-06-03T15:51:28+00:00

Please advise for encryption in flash that can be decrypted easily in PHP.

  • 0

Please advise for encryption in flash that can be decrypted easily in PHP.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T15:51:31+00:00Added an answer on June 3, 2026 at 3:51 pm

    For Flash you can http://code.google.com/p/as3crypto/ it supports

    • RSA
    • DES
    • AES
    • Blowfish –
    • MD5
    • SHA
    • X509
    • RC4

    PHP you can use mycrypt http://www.php.net/manual/en/mcrypt.examples.php RSA, DES, AES, Blowfish, MD5, SHA, X509, RC4 all the above encryption also supported

    Flash Class Example

    package
    {
            import flash.display.Sprite;
            import flash.utils.ByteArray;
    
            import com.hurlant.crypto.symmetric.ICipher;
            import com.hurlant.crypto.symmetric.IVMode;
            import com.hurlant.crypto.symmetric.IMode;
            import com.hurlant.crypto.symmetric.NullPad;
            import com.hurlant.crypto.symmetric.PKCS5;
            import com.hurlant.crypto.symmetric.IPad;
            import com.hurlant.util.Base64;
            import com.hurlant.util.Hex;
            import com.hurlant.crypto.Crypto;
    
            public class CryptoCode extends Sprite
            {
                    private var type:String='simple-des-ecb';
                    private var key:ByteArray;
    
                    public function CryptoCode()
                    {
                            init();
                    }
    
                    private function init():void
                    {
                            key = Hex.toArray(Hex.fromString('TESTTEST'));// can only be 8 characters long
    
                            trace(encrypt('TEST TEST'));
                            trace(decrypt(encrypt('TEST TEST'));
                    }
    
                    private function encrypt(txt:String = ''):String
                    {
                            var data:ByteArray = Hex.toArray(Hex.fromString(txt));
    
                            var pad:IPad = new PKCS5;
                            var mode:ICipher = Crypto.getCipher(type, key, pad);
                            pad.setBlockSize(mode.getBlockSize());
                            mode.encrypt(data);
                            return Base64.encodeByteArray(data);
                    }
                    private function decrypt(txt:String = ''):String
                    {
                            var data:ByteArray = Base64.decodeToByteArray(txt);
                            var pad:IPad = new PKCS5;
                            var mode:ICipher = Crypto.getCipher(type, key, pad);
                            pad.setBlockSize(mode.getBlockSize());
                            mode.decrypt(data);
                            return Hex.toString(Hex.fromArray(data));
                    }
            }
    
    }
    

    PHP Class Example

    class Crypt
    {
            var $key = NULL;
            var $iv = NULL;
            var $iv_size = NULL;
    
            function Crypt()
            {
                    $this->init();
            }
    
            function init($key = "")
            {
                    $this->key = ($key != "") ? $key : "";
    
                    $this->algorithm = MCRYPT_DES;
                    $this->mode = MCRYPT_MODE_ECB;
    
                    $this->iv_size = mcrypt_get_iv_size($this->algorithm, $this->mode);
                    $this->iv = mcrypt_create_iv($this->iv_size, MCRYPT_RAND);
            }
    
            function encrypt($data)
            {
                    $size = mcrypt_get_block_size($this->algorithm, $this->mode);
                    $data = $this->pkcs5_pad($data, $size);
                    return base64_encode(mcrypt_encrypt($this->algorithm, $this->key, $data, $this->mode, $this->iv));
            }
    
            function decrypt($data)
            {
                    return $this->pkcs5_unpad(rtrim(mcrypt_decrypt($this->algorithm, $this->key, base64_decode($data), $this->mode, $this->iv)));
            }
    
            function pkcs5_pad($text, $blocksize)
            {
                    $pad = $blocksize - (strlen($text) % $blocksize);
                    return $text . str_repeat(chr($pad), $pad);
            }
    
            function pkcs5_unpad($text)
            {
                    $pad = ord($text{strlen($text)-1});
                    if ($pad > strlen($text)) return false;
                    if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) return false;
                    return substr($text, 0, -1 * $pad);
            }
    }
    

    Usage flash

    // instance of crypto class
     private var _crypto : CryptoCode;
     public var myLoader : URLLoader;
    
    // create instance with encryption key
     _crypto = new CryptoCode("PASSWORD");
    
    // send crypted string to php script
     var variables : URLVariables = new URLVariables();
     variables.message = _crypto.encrypt(tosend_in.text);
    
    // create request with POST method
     var request : URLRequest = new URLRequest("http://www.lecrabe.net/wordpress/demo/crypt/scripts/testcrypto.php");
     request.method = URLRequestMethod.POST;
     request.data = variables;
    
     // send request
     myLoader.load(request);
    

    Usage PHP

    include_once "lib/cryptlib.php";
    
    // init a new instance of Crypto Class
    $crypto = new Crypt;
    
    // init with the encryption key
    $result = $crypto->init("PASSWORD");
    
    // get the POST data
    $messagefromflash = $_POST ["message"];
    
    // decrypt data
    $decrypted_messagefromflash = $crypto->decrypt(utf8_decode($messagefromflash));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please advise me a jQuery carousel plugin that can make a carousel like the
Please advise if you can. I am building an SMS web service API that
Can someone please advise on uploading a file using the DAV protocol in PHP?
Can anyone please advise where i'm going wrong with the following? I want the
Can anyone please advise me if there will be any problems changing the wordpress
Please advise whether I am hallucinating... I hope so because I can't get tables
Please advise me. Winforms app, C#. I have a user control (UC) that contains
Can anyone please advise what is the best to achieve the below: Requirement: Drop
Can you please advise what is wrong here. This is how my method in
Can anyone please advise the syntax for passing a table FROM a SAS library

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.