It turns out that MD5 is completely broken. My theory was that it should migrate from the Flash version and BinaryData should have been a drop-in replacement or ByteArray.
Well, the theory didn’t work out and I spent a long time trying to figure out why it’s broken. It seems to be broken in both Flash and JS runtimes. For kicks, I tried the MD5Stream version as well and that didn’t work either. I tried various combinations with endians and that did not seem to be like it. I’m pretty stumped. I did manage to successfully incorporate a JS implementation of MD5 in a Royale class[1] in my project, so I’m personally not stuck on this issue. Anyone interested in looking at this? Harbs [1]https://github.com/blueimp/JavaScript-MD5 <https://github.com/blueimp/JavaScript-MD5> > On Nov 27, 2017, at 1:18 PM, [email protected] wrote: > > This is an automated email from the ASF dual-hosted git repository. > > harbs pushed a commit to branch develop > in repository https://gitbox.apache.org/repos/asf/royale-asjs.git > > > The following commit(s) were added to refs/heads/develop by this push: > new ae6da3c Added failing test for MD5 > ae6da3c is described below > > commit ae6da3c1bb3f663c641153b7b3b60f6d8a90b54b > Author: Harbs <[email protected]> > AuthorDate: Mon Nov 27 13:18:38 2017 +0200 > > Added failing test for MD5 > --- > .../src/main/royale/flexUnitTests/CoreTester.as | 3 +- > .../{CoreTester.as => core/MD5Test.as} | 50 ++++++++++++++-------- > 2 files changed, 33 insertions(+), 20 deletions(-) > > diff --git > a/manualtests/UnitTests/src/main/royale/flexUnitTests/CoreTester.as > b/manualtests/UnitTests/src/main/royale/flexUnitTests/CoreTester.as > index 9af36e3..5ce4e9a 100644 > --- a/manualtests/UnitTests/src/main/royale/flexUnitTests/CoreTester.as > +++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/CoreTester.as > @@ -27,7 +27,7 @@ package flexUnitTests > public function CoreTester() > { > // for JS, force-link these classes in the output > - var arr:Array = [StrandTesterTest, BinaryDataTesterTest]; > + var arr:Array = [StrandTesterTest, BinaryDataTesterTest,MD5Test]; > } > > // in JS, using a class as a type won't include the class in > @@ -39,5 +39,6 @@ package flexUnitTests > // better and allow you to define order. > public var strandTesterTest:StrandTesterTest; > public var binaryDataTesterTest:BinaryDataTesterTest; > + public var md5Test:MD5Test; > } > } > diff --git > a/manualtests/UnitTests/src/main/royale/flexUnitTests/CoreTester.as > b/manualtests/UnitTests/src/main/royale/flexUnitTests/core/MD5Test.as > similarity index 52% > copy from manualtests/UnitTests/src/main/royale/flexUnitTests/CoreTester.as > copy to manualtests/UnitTests/src/main/royale/flexUnitTests/core/MD5Test.as > index 9af36e3..20dc46f 100644 > --- a/manualtests/UnitTests/src/main/royale/flexUnitTests/CoreTester.as > +++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/core/MD5Test.as > @@ -16,28 +16,40 @@ > // limitations under the License. > // > //////////////////////////////////////////////////////////////////////////////// > -package flexUnitTests > +package flexUnitTests.core > { > - import flexUnitTests.core.* > - > - [Suite] > - [RunWith("org.flexunit.runners.Suite")] > - public class CoreTester > - { > - public function CoreTester() > + import flexunit.framework.Assert; > + > + import org.apache.royale.utils.MD5; > + > + public class MD5Test > + { > + [Before] > + public function setUp():void > { > - // for JS, force-link these classes in the output > - var arr:Array = [StrandTesterTest, BinaryDataTesterTest]; > } > > - // in JS, using a class as a type won't include the class in > - // the output since types are not chcked in JS. It is when > - // the actual class is referenced that it will be included > - // in the output. > - // Is there a reason to use reflection to gather the set > - // of tests? I would think an array of tests would wokr > - // better and allow you to define order. > - public var strandTesterTest:StrandTesterTest; > - public var binaryDataTesterTest:BinaryDataTesterTest; > + [After] > + public function tearDown():void > + { > + } > + > + [BeforeClass] > + public static function setUpBeforeClass():void > + { > + } > + > + [AfterClass] > + public static function tearDownAfterClass():void > + { > + } > + > + [Test] > + public function testHash():void > + { > + Assert.assertEquals("Error testing foobaz", > "80338e79d2ca9b9c090ebaaa2ef293c7",MD5.hash("foobaz")); > + Assert.assertEquals("Error testing bazfoo", > "b6a013d5e2c00f894584ad577249dbc7",MD5.hash("bazfoo")); > + Assert.assertEquals("Error testing password1234", > "bdc87b9c894da5168059e00ebffb9077",MD5.hash("password1234")); > + } > } > } > > -- > To stop receiving notification emails like this one, please contact > ['"[email protected]" <[email protected]>'].
