actionscript 3 - Different MD5 with as3corelib -
i'm trying md5 file as3corelib, if compare as3 hash php one, different strings.
that's do:
_loader = new urlloader(); _loader.load( new urlrequest( "image.jpg" ) ); _loader.addeventlistener( event.complete, completehandler ); private function completehandler( event:event ):void { var data:bytearray = new bytearray(); data.writeutfbytes( _loader.data ); var hash:md5stream = new md5stream(); trace(hash.complete(data)); }
i've googled issue, finding post similar thing discussed (making hash of string).
any idea?
try set loader dataformat property urlloaderdataformat.binary prior load() call:
_loader = new urlloader(); _loader.dataformat = urlloaderdataformat.binary; _loader.load( new urlrequest( "image.jpg" ) ); _loader.addeventlistener( event.complete, completehandler ); private function completehandler( event:event ):void { var hash:md5stream = new md5stream(); trace(hash.complete(_loader.data)); }
then use directly _loader.data variable since it's bytearray
Comments
Post a Comment