首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    XXTEA加解密as3和python分别

    package { import flash.display.Shape; import flash.display.Sprite; import flash.utils.ByteArray; public class Test extends Sprite { public function Test() { var dataStr:String = "Today's weather is good."; var data:ByteArray = new ByteArray(); data.writeMultiByte(dataStr, "utf-8"); var keyStr:String = "abcxyz123"; var key:ByteArray = new ByteArray(); key.writeMultiByte(keyStr, "utf-8"); trace("data:", dataStr); trace("key:", keyStr); //加密 var encryptData:ByteArray = XXTEA.encrypt(data, key); var content:String = Base64.encodeByteArray(encryptData); trace("encode: " + content); //解密 encryptData = Base64.decodeToByteArray(content); var sourceBtyes:ByteArray = XXTEA.decrypt(encryptData, key); var sourceStr:String = sourceBtyes.toString(); trace("decode: " + sourceStr ); } } }

    06
    领券