/trunk/api/js/dojo1.0/dojox/crypto/tests/Blowfish.js |
---|
New file |
0,0 → 1,29 |
if(!dojo._hasResource["dojox.crypto.tests.Blowfish"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["dojox.crypto.tests.Blowfish"] = true; |
dojo.provide("dojox.crypto.tests.Blowfish"); |
dojo.require("dojox.crypto.Blowfish"); |
(function(){ |
var message="The rain in Spain falls mainly on the plain."; |
var key="foobar"; |
var base64Encrypted="WI5J5BPPVBuiTniVcl7KlIyNMmCosmKTU6a/ueyQuoUXyC5dERzwwdzfFsiU4vBw"; |
var dxc=dojox.crypto; |
tests.register("dojox.crypto.tests.Blowfish", [ |
function testEncrypt(t){ |
t.assertEqual(base64Encrypted, dxc.Blowfish.encrypt(message, key)); |
}, |
function testDecrypt(t){ |
t.assertEqual(message, dxc.Blowfish.decrypt(base64Encrypted, key)); |
}, |
function testShortMessage(t){ |
var msg="pass"; |
var pwd="foobar"; |
var enc=dxc.Blowfish.encrypt(msg, pwd); |
var dec=dxc.Blowfish.decrypt(enc, pwd); |
t.assertEqual(dec, msg); |
} |
]); |
})(); |
} |
/trunk/api/js/dojo1.0/dojox/crypto/tests/runTests.html |
---|
New file |
0,0 → 1,9 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
<html> |
<head> |
<title>Dojox.wire Unit Test Runner</title> |
<meta http-equiv="REFRESH" content="0;url=../../../util/doh/runner.html?testModule=dojox.crypto.tests.crypto"></HEAD> |
<BODY> |
Redirecting to D.O.H runner. |
</BODY> |
</HTML> |
/trunk/api/js/dojo1.0/dojox/crypto/tests/crypto.js |
---|
New file |
0,0 → 1,13 |
if(!dojo._hasResource["dojox.crypto.tests.crypto"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["dojox.crypto.tests.crypto"] = true; |
dojo.provide("dojox.crypto.tests.crypto"); |
dojo.require("dojox.crypto"); |
try{ |
dojo.require("dojox.crypto.tests.MD5"); |
dojo.require("dojox.crypto.tests.Blowfish"); |
}catch(e){ |
doh.debug(e); |
} |
} |
/trunk/api/js/dojo1.0/dojox/crypto/tests/MD5.js |
---|
New file |
0,0 → 1,26 |
if(!dojo._hasResource["dojox.crypto.tests.MD5"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["dojox.crypto.tests.MD5"] = true; |
dojo.provide("dojox.crypto.tests.MD5"); |
dojo.require("dojox.crypto.MD5"); |
(function(){ |
var message="The rain in Spain falls mainly on the plain."; |
var base64="OUhxbVZ1Mtmu4zx9LzS5cA=="; |
var hex="3948716d567532d9aee33c7d2f34b970"; |
var s="9HqmVu2\xD9\xAE\xE3<}/4\xB9p"; |
var dxc=dojox.crypto; |
tests.register("dojox.crypto.tests.MD5", [ |
function testBase64Compute(t){ |
t.assertEqual(base64, dxc.MD5.compute(message)); |
}, |
function testHexCompute(t){ |
t.assertEqual(hex, dxc.MD5.compute(message, dxc.outputTypes.Hex)); |
}, |
function testStringCompute(t){ |
t.assertEqual(s, dxc.MD5.compute(message, dxc.outputTypes.String)); |
} |
]); |
})(); |
} |