久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Flash 加密 PHP 解密

Flash Encryption PHP Decryption(Flash 加密 PHP 解密)
本文介紹了Flash 加密 PHP 解密的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

請建議使用可以在PHP中輕松解密的閃存加密.

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

推薦答案

對于 Flash,您可以 http://code.google.com/p/as3crypto/ 支持

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

  • RSA
  • DES
  • AES
  • 河豚 -
  • MD5
  • SHA
  • X509
  • RC4

PHP 你可以使用 mycrypt http://www.php.net/manual/en/mcrypt.examples.php 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 類示例

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 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);
        }
}

使用閃存

// 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);

使用 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));

這篇關于Flash 加密 PHP 解密的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 在线免费观看a级片 | 精品一级电影 | 亚洲精选久久 | 久久无毛| 一级a爱片性色毛片免费 | 91成人免费看 | 97av视频在线 | 国产成人精品一区二区三区网站观看 | av毛片| h视频在线播放 | 天天综合网永久 | 日本电影一区二区 | 九色 在线 | 野狼在线社区2017入口 | 99久久精品国产毛片 | 激情a| 国产精品国产三级国产aⅴ中文 | 日韩精品一区二区三区中文在线 | 成人免费在线电影 | 欧美成人免费在线视频 | 亚洲精品乱码久久久久久黑人 | 国产欧美日韩综合精品一 | 一区二区三区韩国 | 日韩中文字幕2019 | 免费av毛片 | 亚洲成人免费观看 | 久久国产精品视频 | 亚州综合一区 | 一区二区在线不卡 | 久久精品91久久久久久再现 | 亚洲精品永久免费 | 日韩欧美在线观看 | 99久久99久久精品国产片果冰 | 中文字幕蜜臀av | 亚洲性综合网 | 国产激情自拍视频 | 国产欧美一区二区三区国产幕精品 | 久久视频精品 | 毛片一区二区 | www国产成人免费观看视频,深夜成人网 | 毛片免费观看 |