MCPcopy Create free account
hub / github.com/browserify/crypto-browserify / binb2b64

Function binb2b64

example/bundle.js:584–594  ·  view source on GitHub ↗
(binarray)

Source from the content-addressed store, hash-verified

582 * Convert an array of big-endian words to a base-64 string
583 */
584 function binb2b64(binarray) {
585 var tab = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
586 var str = '';
587 for (var i = 0; i < binarray.length * 4; i += 3) {
588 var triplet = (((binarray[i >> 2] >> 8 * (3 - i % 4)) & 0xFF) << 16) | (((binarray[i + 1 >> 2] >> 8 * (3 - (i + 1) % 4)) & 0xFF) << 8) | ((binarray[i + 2 >> 2] >> 8 * (3 - (i + 2) % 4)) & 0xFF);
589 for (var j = 0; j < 4; j++) {
590 if (i * 8 + j * 6 > binarray.length * 32) { str += b64pad; } else { str += tab.charAt((triplet >> 6 * (3 - j)) & 0x3F); }
591 }
592 }
593 return str;
594 }
595
596});
597

Callers 2

b64_sha1Function · 0.85
b64_hmac_sha1Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…