Base64_Encode and Decode
Little javascript scriptlet used in OO, to play with Base64
Base64_encode
var base64_encode = function (a,b,c,d,e,f) {
b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
c="=";
for(d=f="";e&=3,a.charAt(d++)||(b="=",e);f+=b.charAt(63&c>>++e*2))c=c<<8|a.charCodeAt(d-=!e);
return f
};
coded = base64_encode(scriptletInput);
scriptletResult = coded;
Base64_decode
var base64_decode = function( d,b,c,u,r,q,x ) {
b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
for(r=q=x="";c=d.charAt(x++);~c&&(u=q%4?u*64+c:c,q++%4)?r+=String.fromCharCode(255&u>>(-2*q&6)):0) c=b.indexOf(c);
return r;
};
decoded = base64_decode(scriptletInput);
scriptletResult = decoded;