Short base64 in js

2011-06-01

Absolutely not mine, but this is a short base 64 function in js. In fact, I've not validated it yet at all :p But I wanted to log it down for future reference. After all, that's what this section is all about.

Code: (js)
function(a,b,c,d,e,f){for(e=f='';b[1];d=4)for(c=c<<8|a.charCodeAt(f++);!(f%3)&&d--;b=a[f-d]?b:'=')e+=b[c>>d*6&63];return e}

By @internot_ (or well, at least that seemed to be the end golfer :)