summaryrefslogtreecommitdiffstatshomepage
path: root/includes/js/dojox/encoding/digests/_base.js
diff options
context:
space:
mode:
authorGravatar mensonge2008-11-14 15:39:19 +0000
committerGravatar mensonge2008-11-14 15:39:19 +0000
commit1c5685d68f1b73270fb814fe04cbb490eb90ba5f (patch)
tree3d3ada08a934b96fc31531f1327690d7edc6f766 /includes/js/dojox/encoding/digests/_base.js
parent104d59099e048688c4dbac37d72137006e396558 (diff)
downloadscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.gz
scuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.zip
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
Diffstat (limited to 'includes/js/dojox/encoding/digests/_base.js')
-rw-r--r--includes/js/dojox/encoding/digests/_base.js78
1 files changed, 0 insertions, 78 deletions
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<<chrsz)-1;
-
- d.stringToWord=function(/* string */s){
- // summary
- // convert a string to a word array
- var wa=[];
- for(var i=0, l=s.length*chrsz; i<l; i+=chrsz){
- wa[i>>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<l; i+=chrsz){
- s.push(String.fromCharCode((wa[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<l; i++){
- s.push(h.charAt((wa[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<l; i+=3){
- var t=(((wa[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
- };
-})();
-
-}