This content has been marked as final. Show 4 replies
The MXP format is used for extending the Flash Authoring tool (I don't know if that's still the case). It isn't something you could use in an HTML-based AIR app, at least not directly.
There is an open source crypto library, http://code.google.com/p/as3crypto/, for ActionScript. The Flex SDK also has a utility function for SHA256, if that's an option (it doesn't have a SHA-1 function).
To use these, you will have to load the library into your application using a script tag, as described here: http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7ed9. html. (And to use the Flex SDK functions, you would, of course, have to create the library first).
Thanks very much for the useful info.
I'm going to give this a try asap.
Does anyone know a way of getting an Air app to do this in a reasonable amount of time (a few seconds)?
Have you tried these algorithms with a tiny file, say, 1 KB? If you're starting out with something a few GB, maybe it's just not crunching through it fast enough for your purposes. If that works, work your way up to your actual file size by steps to see if either it's either a data rate problem or some size threshold issue.
EDIT: ActionScript/Flex can be deceptively fast when you use it for what it was designed to do, being a scripting language to drive the Flash player, which has a lot of highly-optimized native code in it. Used this way, the majority of your CPU time can be spent executing native code instead of interpreting AS code.
EDIT: For pure number crunching, you're spending 100% of your time in AS code, which could easily be 10 or more times slower than native, apples-to-apples. An AS-optimized library should be able to avoid the worst problem that affects JS code of this sort, the lack of true integers. (The Number type is a float!) I'd try that SHA256 routine, though, as they may be delegating to native code in the Flash player. It's a better algorithm anyway. SHA-1 has a few known weaknesses; not as bad as MD5, but not bulletproof, either.