lib/lib.js
function (input) {
			var bi = BigInteger.fromByteArrayUnsigned(input);
			var chars = [];

			while (bi.compareTo(B58.base) >= 0) {
				var mod = bi.mod(B58.base);
				chars.unshift(B58.alphabet[mod.intValue()]);
				bi = bi.subtract(mod).divide(B58.base);
			}
			chars.unshift(B58.alphabet[bi.intValue()]);

			// Convert leading zeros too.
			for (var i = 0; i < input.length; i++) {
				if (input[i] == 0x00) {
					chars.unshift(B58.alphabet[0]);
				} else break;
			}

			return chars.join('');
		}
function (input) {
			var bi = BigInteger.fromByteArrayUnsigned(input);
			var chars = [];

			while (bi.compareTo(B58.base) >= 0) {
				var mod = bi.mod(B58.base);
				chars.unshift(B58.alphabet[mod.intValue()]);
				bi = bi.subtract(mod).divide(B58.base);
			}
			chars.unshift(B58.alphabet[bi.intValue()]);

			// Convert leading zeros too.
			for (var i = 0; i < input.length; i++) {
				if (input[i] == 0x00) {
					chars.unshift(B58.alphabet[0]);
				} else break;
			}

			return chars.join('');
		}
function ( input ) { var bi = BigInteger . fromByteArrayUnsigned ( input ) ; var chars = [ ] ; while ( bi . compareTo ( B58 . base ) >= 0 ) { var mod = bi . mod ( B58 . base ) ; chars . unshift ( B58 . alphabet [ mod . intValue ( ) ] ) ; bi = bi . subtract ( mod ) . divide ( B58 . base ) ; } chars . unshift ( B58 . alphabet [ bi . intValue ( ) ] ) ; // Convert leading zeros too. for ( var i = 0 ; i < input . length ; i ++ ) { if ( input [ i ] == 0x00 ) { chars . unshift ( B58 . alphabet [ 0 ] ) ; } else break ; } return chars . join ( '' ) ; }
Convert a byte array to a base58-encoded string.

Written by Mike Hearn for BitcoinJ.
Copyright (c) 2011 Google Inc.

Ported to JavaScript by Stefan Thomas.
Convert a byte array to a base58 - encoded string .