From 1c5685d68f1b73270fb814fe04cbb490eb90ba5f Mon Sep 17 00:00:00 2001 From: mensonge Date: Fri, 14 Nov 2008 15:39:19 +0000 Subject: Minor fix: Remove DOJO library (60Mo) replaced by link to Google CDN (online DOJO library) git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@159 b3834d28-1941-0410-a4f8-b48e95affb8f --- includes/js/dojox/encoding/digests/MD5.js | 177 ---------------------------- includes/js/dojox/encoding/digests/_base.js | 78 ------------ 2 files changed, 255 deletions(-) delete mode 100644 includes/js/dojox/encoding/digests/MD5.js delete mode 100644 includes/js/dojox/encoding/digests/_base.js (limited to 'includes/js/dojox/encoding/digests') diff --git a/includes/js/dojox/encoding/digests/MD5.js b/includes/js/dojox/encoding/digests/MD5.js deleted file mode 100644 index eb72d59..0000000 --- a/includes/js/dojox/encoding/digests/MD5.js +++ /dev/null @@ -1,177 +0,0 @@ -if(!dojo._hasResource["dojox.encoding.digests.MD5"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.encoding.digests.MD5"] = true; -dojo.provide("dojox.encoding.digests.MD5"); - -dojo.require("dojox.encoding.digests._base"); - -/* A port of Paul Johnstone's MD5 implementation - * http://pajhome.org.uk/crypt/md5/index.html - * - * Copyright (C) Paul Johnston 1999 - 2002. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * Distributed under the BSD License - * - * Dojo port by Tom Trenka - */ -(function(){ - var dxd=dojox.encoding.digests; - var chrsz=8; - - // MD5 rounds functions - function R(n,c){ return (n<>>(32-c)); } - function C(q,a,b,x,s,t){ return dxd.addWords(R(dxd.addWords(dxd.addWords(a, q), dxd.addWords(x, t)), s), b); } - function FF(a,b,c,d,x,s,t){ return C((b&c)|((~b)&d),a,b,x,s,t); } - function GG(a,b,c,d,x,s,t){ return C((b&d)|(c&(~d)),a,b,x,s,t); } - function HH(a,b,c,d,x,s,t){ return C(b^c^d,a,b,x,s,t); } - function II(a,b,c,d,x,s,t){ return C(c^(b|(~d)),a,b,x,s,t); } - - // the core MD5 rounds method - function core(x,len){ - x[len>>5]|=0x80<<((len)%32); - x[(((len+64)>>>9)<<4)+14]=len; - var a= 1732584193; - var b=-271733879; - var c=-1732584194; - var d= 271733878; - for(var i=0; i16){ - wa=core(wa, key.length*chrsz); - } - var l=[], r=[]; - for(var i=0; i<16; i++){ - l[i]=wa[i]^0x36363636; - r[i]=wa[i]^0x5c5c5c5c; - } - var h=core(l.concat(dxd.stringToWord(data)), 512+data.length*chrsz); - return core(r.concat(h), 640); - } - - // public function - dxd.MD5=function(/* string */data, /* dojox.encoding.digests.outputTypes? */outputType){ - // summary - // computes the digest of data, and returns the result according to type outputType - var out=outputType || dxd.outputTypes.Base64; - var wa=core(dxd.stringToWord(data), data.length*chrsz); - switch(out){ - case dxd.outputTypes.Raw:{ - return wa; // word[] - } - case dxd.outputTypes.Hex:{ - return dxd.wordToHex(wa); // string - } - case dxd.outputTypes.String:{ - return dxd.wordToString(wa); // string - } - default:{ - return dxd.wordToBase64(wa); // string - } - } - }; - - // make this private, for later use with a generic HMAC calculator. - dxd.MD5._hmac=function(/* string */data, /* string */key, /* dojox.encoding.digests.outputTypes? */outputType){ - // summary - // computes the digest of data, and returns the result according to type outputType - var out=outputType || dxd.outputTypes.Base64; - var wa=hmac(data, key); - switch(out){ - case dxd.outputTypes.Raw:{ - return wa; // word[] - } - case dxd.outputTypes.Hex:{ - return dxd.wordToHex(wa); // string - } - case dxd.outputTypes.String:{ - return dxd.wordToString(wa); // string - } - default:{ - return dxd.wordToBase64(wa); // string - } - } - }; -})(); - -} diff --git a/includes/js/dojox/encoding/digests/_base.js b/includes/js/dojox/encoding/digests/_base.js deleted file mode 100644 index 3ebae22..0000000 --- a/includes/js/dojox/encoding/digests/_base.js +++ /dev/null @@ -1,78 +0,0 @@ -if(!dojo._hasResource["dojox.encoding.digests._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dojox.encoding.digests._base"] = true; -dojo.provide("dojox.encoding.digests._base"); - -(function(){ - //TODO: see if it makes sense to meld this into one with the - // crypto base enums - var d=dojox.encoding.digests; - d.outputTypes={ - // summary - // Enumeration for input and output encodings. - Base64:0, Hex:1, String:2, Raw:3 - }; - - // word-based addition - d.addWords=function(/* word */a, /* word */b){ - // summary - // add a pair of words together with rollover - var l=(a&0xFFFF)+(b&0xFFFF); - var m=(a>>16)+(b>>16)+(l>>16); - return (m<<16)|(l&0xFFFF); // word - }; - - // word-based conversion method, for efficiency sake; - // most digests operate on words, and this should be faster - // than the encoding version (which works on bytes). - var chrsz=8; - var mask=(1<>5]|=(s.charCodeAt(i/chrsz)&mask)<<(i%32); - } - return wa; // word[] - }; - - d.wordToString=function(/* word[] */wa){ - // summary - // convert an array of words to a string - var s=[]; - for(var i=0, l=wa.length*32; i>5]>>>(i%32))&mask)); - } - return s.join(""); // string - } - - d.wordToHex=function(/* word[] */wa){ - // summary - // convert an array of words to a hex tab - var h="0123456789abcdef", s=[]; - for(var i=0, l=wa.length*4; i>2]>>((i%4)*8+4))&0xF)+h.charAt((wa[i>>2]>>((i%4)*8))&0xF)); - } - return s.join(""); // string - } - d.wordToBase64=function(/* word[] */wa){ - // summary - // convert an array of words to base64 encoding, should be more efficient - // than using dojox.encoding.base64 - var p="=", tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", s=[]; - for(var i=0, l=wa.length*4; i>2]>>8*(i%4))&0xFF)<<16)|(((wa[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((wa[i+2>>2]>>8*((i+2)%4))&0xFF); - for(var j=0; j<4; j++){ - if(i*8+j*6>wa.length*32){ - s.push(p); - } else { - s.push(tab.charAt((t>>6*(3-j))&0x3F)); - } - } - } - return s.join(""); // string - }; -})(); - -} -- cgit v1.2.3