dojox/encoding/ascii85.js

  • Provides:

    • dojox.encoding.ascii85
  • dojox.encoding.ascii85.encode

    • type
      Function
    • parameters:
      • input: (typeof Array)
        an array of numbers (0-255) to encode
    • source: [view]
        var result = [], reminder = input.length % 4, length = input.length - reminder;
        c(input, length, result);
        if(reminder){
         var t = input.slice(length);
         while(t.length < 4){ t.push(0); }
         c(t, 4, result);
         var x = result.pop();
         if(x == "z"){ x = "!!!!!"; }
         result.push(x.substr(0, reminder + 1));
        }
        return result.join(""); // String
    • summary
      encodes input data in ascii85 string
    • returns
      String
  • dojox.encoding.ascii85.decode

    • type
      Function
    • parameters:
      • input: (typeof String)
        the input string to decode
    • source: [view]
        var n = input.length, r = [], b = [0, 0, 0, 0, 0], i, j, t, x, y, d;
        for(i = 0; i < n; ++i){
         if(input.charAt(i) == "z"){
          r.push(0, 0, 0, 0);
          continue;
         }
         for(j = 0; j < 5; ++j){ b[j] = input.charCodeAt(i + j) - 33; }
         d = n - i;
         if(d < 5){
          for(j = d; j < 4; b[++j] = 0);
          b[d] = 85;
         }
         t = (((b[0] * 85 + b[1]) * 85 + b[2]) * 85 + b[3]) * 85 + b[4];
         x = t & 255;
         t >>>= 8;
         y = t & 255;
         t >>>= 8;
         r.push(t >>> 8, t & 255, y, x);
         for(j = d; j < 5; ++j, r.pop());
         i += 4;
        }
        return r;
    • summary
      decodes the input string back to array of numbers
  • dojox.encoding.ascii85

    • type
      Object
    • summary
  • dojox.encoding

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary