crypt.js
function(bytes) {
      for (var base64 = [], i = 0; i < bytes.length; i += 3) {
        var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
        for (var j = 0; j < 4; j++)
          if (i * 8 + j * 6 <= bytes.length * 8)
            base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
          else
            base64.push('=');
      }
      return base64.join('');
    }
function(bytes) {
      for (var base64 = [], i = 0; i < bytes.length; i += 3) {
        var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
        for (var j = 0; j < 4; j++)
          if (i * 8 + j * 6 <= bytes.length * 8)
            base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
          else
            base64.push('=');
      }
      return base64.join('');
    }
function ( bytes ) { for ( var base64 = [ ] , i = 0 ; i < bytes . length ; i += 3 ) { var triplet = ( bytes [ i ] << 16 ) | ( bytes [ i + 1 ] << 8 ) | bytes [ i + 2 ] ; for ( var j = 0 ; j < 4 ; j ++ ) if ( i * 8 + j * 6 <= bytes . length * 8 ) base64 . push ( base64map . charAt ( ( triplet >>> 6 * ( 3 - j ) ) & 0x3F ) ) ; else base64 . push ( '=' ) ; } return base64 . join ( '' ) ; }
Convert a byte array to a base-64 string
Convert a byte array to a base - 64 string