Debian Codegraph @

dojox/encoding/tests/crypto/Blowfish.js

raw symbols SCIP
1 define(['doh', '../../crypto/Blowfish'], function(doh, Blowfish){
2 var message="The rain in Spain falls mainly on the plain.";
3 var key="foobar";
4 var base64Encrypted="WI5J5BPPVBuiTniVcl7KlIyNMmCosmKTU6a/ueyQuoUXyC5dERzwwdzfFsiU4vBw";
5
6 tests.register("dojox.encoding.crypto.tests.Blowfish", [
7 function testEncrypt(t){
8 var dt=new Date();
9 t.assertEqual(base64Encrypted, Blowfish.encrypt(message, key));
10 doh.debug("testEncrypt: ", new Date()-dt, "ms.");
11 },
12 function testDecrypt(t){
13 var dt=new Date();
14 t.assertEqual(message, Blowfish.decrypt(base64Encrypted, key));
15 doh.debug("testDecrypt: ", new Date()-dt, "ms.");
16 },
17 function testShortMessage(t){
18 var msg="pass";
19 var pwd="foobar";
20 var dt=new Date();
21 var enc=Blowfish.encrypt(msg, pwd);
22 var dec=Blowfish.decrypt(enc, pwd);
23 t.assertEqual(dec, msg);
24 doh.debug("testShortMessage: ", new Date()-dt, "ms.");
25 }
26 ]);
27 });