// Path: src/main/java/io/github/novacrypto/base58/Base58.java
// public final class Base58 {
// 
//     Base58() {
//     }
// 
//     public static GeneralEncoderDecoder newInstanceWithBuffer(final WorkingBuffer workingBuffer) {
//         return new Base58EncoderDecoder(workingBuffer);
//     }
// 
//     public static EncoderDecoder newInstance() {
//         return newInstanceWithBuffer(new ByteArrayWorkingBuffer());
//     }
// 
//     public static SecureEncoderDecoder newSecureInstance() {
//         return newInstanceWithBuffer(new SecureWorkingBuffer());
//     }
// 
//     private static final ThreadLocal<EncoderDecoder> working = new ThreadLocal<>();
// 
//     /**
//      * Encodes given bytes as a number in base58.
//      * Threadsafe, uses an instance per thread.
//      *
//      * @param bytes bytes to encode
//      * @return base58 string representation
//      */
//     public static String base58Encode(final byte[] bytes) {
//         return getThreadSharedBase58().encode(bytes);
//     }
// 
//     /**
//      * Decodes given bytes as a number in base58.
//      * Threadsafe, uses an instance per thread.
//      *
//      * @param base58 string to decode
//      * @return number as bytes
//      */
//     public static byte[] base58Decode(final CharSequence base58) {
//         return getThreadSharedBase58().decode(base58);
//     }
// 
//     private static EncoderDecoder getThreadSharedBase58() {
//         EncoderDecoder base58 = working.get();
//         if (base58 == null) {
//             base58 = newInstance();
//             working.set(base58);
//         }
//         return base58;
//     }
// }
// 
// Path: src/main/java/io/github/novacrypto/base58/EncodeTarget.java
// public interface EncodeTarget {
//     void append(char c);
// }


import io.github.novacrypto.base58.EncodeTarget;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import io.github.novacrypto.base58.Base58;
    @Test
    public void twoFiveFiveByteArrayLength1() {
        assertBase58("5Q", new byte[]{(byte) 255});
    }

    @Test
    public void twoFiveFiveByteArrayLength2() {
        assertBase58("LUv", new byte[]{(byte) 255, (byte) 255});
    }

    @Test
    public void allByteValues() {
        final byte[] bytes = new byte[256];
        for (int i = 0; i < bytes.length; i++) {
            bytes[i] = (byte) i;
        }
        assertBase58(
                "1cWB5HCBdLjAuqGGReWE3R3CguuwSjw6RHn39s2yuDRTS5NsBgNiFpWgAnEx6VQi8csexkgYw3mdYrMHr8x9i7aEwP8kZ7vccXWqKDvGv3u1GxFKPuAkn8JCPPGDMf3vMMnbzm6Nh9zh1gcNsMvH3ZNLmP5fSG6DGbbi2tuwMWPthr4boWwCxf7ewSgNQeacyozhKDDQQ1qL5fQFUW52QKUZDZ5fw3KXNQJMcNTcaB723LchjeKun7MuGW5qyCBZYzA1KjofN1gYBV3NqyhQJ3Ns746GNuf9N2pQPmHz4xpnSrrfCvy6TVVz5d4PdrjeshsWQwpZsZGzvbdAdN8MKV5QsBDY",
                bytes);
    }

    private void assertBase58(final String expected, final byte[] bytes) {
        assertEquals(expected, base58InstanceEncode(bytes));
        assertEquals(expected, base58StaticEncode(bytes));
        assertEquals(expected, base58SecureInstanceEncode(bytes));
        assertEquals(expected, base58SecureInstanceEncodeSetCapacity(bytes));
        assertEquals(expected, base58SecureInstanceEncodeFluentCapacity(bytes));
    }

    static String base58InstanceEncode(final byte[] bytes) {
// Path: src/main/java/io/github/novacrypto/base58/Base58.java
// public final class Base58 {
// 
//     Base58() {
//     }
// 
//     public static GeneralEncoderDecoder newInstanceWithBuffer(final WorkingBuffer workingBuffer) {
//         return new Base58EncoderDecoder(workingBuffer);
//     }
// 
//     public static EncoderDecoder newInstance() {
//         return newInstanceWithBuffer(new ByteArrayWorkingBuffer());
//     }
// 
//     public static SecureEncoderDecoder newSecureInstance() {
//         return newInstanceWithBuffer(new SecureWorkingBuffer());
//     }
// 
//     private static final ThreadLocal<EncoderDecoder> working = new ThreadLocal<>();
// 
//     /**
//      * Encodes given bytes as a number in base58.
//      * Threadsafe, uses an instance per thread.
//      *
//      * @param bytes bytes to encode
//      * @return base58 string representation
//      */
//     public static String base58Encode(final byte[] bytes) {
//         return getThreadSharedBase58().encode(bytes);
//     }
// 
//     /**
//      * Decodes given bytes as a number in base58.
//      * Threadsafe, uses an instance per thread.
//      *
//      * @param base58 string to decode
//      * @return number as bytes
//      */
//     public static byte[] base58Decode(final CharSequence base58) {
//         return getThreadSharedBase58().decode(base58);
//     }
// 
//     private static EncoderDecoder getThreadSharedBase58() {
//         EncoderDecoder base58 = working.get();
//         if (base58 == null) {
//             base58 = newInstance();
//             working.set(base58);
//         }
//         return base58;
//     }
// }
// 
// Path: src/main/java/io/github/novacrypto/base58/EncodeTarget.java
// public interface EncodeTarget {
//     void append(char c);
// }


// Path: src/test/java/io/github/novacrypto/Base58EncodeTests.java
import io.github.novacrypto.base58.EncodeTarget;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import io.github.novacrypto.base58.Base58;

    @Test
    public void twoFiveFiveByteArrayLength1() {
        assertBase58("5Q", new byte[]{(byte) 255});
    }

    @Test
    public void twoFiveFiveByteArrayLength2() {
        assertBase58("LUv", new byte[]{(byte) 255, (byte) 255});
    }

    @Test
    public void allByteValues() {
        final byte[] bytes = new byte[256];
        for (int i = 0; i < bytes.length; i++) {
            bytes[i] = (byte) i;
        }
        assertBase58(
                "1cWB5HCBdLjAuqGGReWE3R3CguuwSjw6RHn39s2yuDRTS5NsBgNiFpWgAnEx6VQi8csexkgYw3mdYrMHr8x9i7aEwP8kZ7vccXWqKDvGv3u1GxFKPuAkn8JCPPGDMf3vMMnbzm6Nh9zh1gcNsMvH3ZNLmP5fSG6DGbbi2tuwMWPthr4boWwCxf7ewSgNQeacyozhKDDQQ1qL5fQFUW52QKUZDZ5fw3KXNQJMcNTcaB723LchjeKun7MuGW5qyCBZYzA1KjofN1gYBV3NqyhQJ3Ns746GNuf9N2pQPmHz4xpnSrrfCvy6TVVz5d4PdrjeshsWQwpZsZGzvbdAdN8MKV5QsBDY",
                bytes);
    }

    private void assertBase58(final String expected, final byte[] bytes) {
        assertEquals(expected, base58InstanceEncode(bytes));
        assertEquals(expected, base58StaticEncode(bytes));
        assertEquals(expected, base58SecureInstanceEncode(bytes));
        assertEquals(expected, base58SecureInstanceEncodeSetCapacity(bytes));
        assertEquals(expected, base58SecureInstanceEncodeFluentCapacity(bytes));
    }

    static String base58InstanceEncode(final byte[] bytes) {
        return Base58.newInstance().encode(bytes);