开发者

blowfish encryption in actionscript 3

I want to mask a string value that I have in my embed code. I thought I could encrypt it using Blowfish or something similar. I don't care that is not secure. Basically I don't want someone to copy the encrypted string from my embed code and get the result. So I thought adding some salt would make it harder. At least they would have to decompile my swf in order to get the salt.

I looked at google code for as3cryto and can't seem to figure out how to write it. I suspect I have to import the class...not sure which class to import and not sure as well what the syntax would be to call the blowfish encrypt and decrypt functions.

Are there any examples out there for as3 开发者_JAVA百科blowfish decrypt and encrypt? I searched and only found people modifying and writing their own classes based on as3crypto. I'm sure it is one simple line but I don't see any examples to pin it down.

I will be using php to generate the encryption string and then use as3 to decrypt it to get the string I need to use in my flash file.

Thanks.


I'm not really up on this stuff, but it seems pretty straightforward, if you read this class: http://code.google.com/p/as3crypto/source/browse/trunk/as3crypto/src/com/hurlant/crypto/symmetric/BlowFishKey.as

The import and declaration would look something like this. It's obviously missing the key info:

import com.hurlant.crypto.symmetric.BlowFishKey;
var key:ByteArray = new ByteArray()
var bfKey:BlowFishKey = new BlowFishKey(key);

Here is an example at Github of an implementation of the BlowFishKey class: https://github.com/jeromeetienne/EasyWebsocket/blob/aa333e059b92c9441bc22b5a84be7ec51008f3d4/node/server/node_modules/socket.io/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/BlowFishKeyTest.as


If you're lazy like me, just convert your string to the ascii values and use String.fromCharCode()

trace( String.fromCharCode( 72,69,76,76,79,32,87,79,82,76,68 ) ); // hello world

After that, you can store the numbers how you want

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜