C_Base64Codec.js 1.6 KB

123456
  1. // Licensed Materials - Property of IBM
  2. // IBM Cognos Products: hal
  3. // (C) Copyright IBM Corp. 2003, 2017.
  4. // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  5. function C_Base64Codec(){if(!this._h252){var o={};var _hBZ1=this._h352.length;for(var i=0;i<_hBZ1;i++){o[this._h352.charAt(i)]=i;}C_Base64Codec.prototype._h252=o;}};C_Base64Codec.prototype._h352="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+=/";C_Base64Codec.prototype.F_Encode=function(_h452){var a=[];var _hGG1=0;var _hBZ1=_h452.length;for(var i=0;i<_hBZ1;i++){var _h6U1=_h452.charCodeAt(i);var _h7U1=(++i<_hBZ1)?_h452.charCodeAt(i):0;var _h8U1=(++i<_hBZ1)?_h452.charCodeAt(i):0;var _hTN1=_h6U1 >> 2;var _hUN1=((_h6U1 & 3)<< 4)|(_h7U1 >> 4);var _hVN1=((_h7U1 & 15)<< 2)|(_h8U1 >> 6);var _hWN1=_h8U1 & 63;a.push(this._h352.charAt(_hTN1));a.push(this._h352.charAt(_hUN1));a.push(_h7U1?this._h352.charAt(_hVN1):"=");a.push(_h8U1?this._h352.charAt(_hWN1):"=");if(++_hGG1==19){a.push("\r\n");_hGG1=0;}}return a.join("");};C_Base64Codec.prototype.F_Decode=function(_h452){var s=_h452.replace(/[^A-Za-z0-9\+\/\=]/g, "");var a=[];var _hBZ1=s.length;for(var i=0;i<_hBZ1;i++){var _h6U1=this._h252[s.charAt(i)];var _h7U1=(++i<_hBZ1)?this._h252[s.charAt(i)]:0;var _h8U1=(++i<_hBZ1)?this._h252[s.charAt(i)]:0;var _h9U1=(++i<_hBZ1)?this._h252[s.charAt(i)]:0;a.push(String.fromCharCode((_h6U1 << 2)|(_h7U1 >> 4)));if(_h8U1!=63){a.push(String.fromCharCode(((_h7U1 & 15)<< 4)|(_h8U1 >> 2)));if(_h9U1!=63){a.push(String.fromCharCode(((_h8U1 & 3)<< 6)| _h9U1));}}}return a.join("");};