Search code examples
javabase32

Java z-base-32 encoding algorithm


I'm searching for an implementation of z-base-32 enc algo in java, any suggestions? (encoding and decoding)


Solution

  • Ok, I felt I had to give this a shot. I translated the C# implementation from My Ten Pennies to Java, and an example and source an be downloaded from here. It's not especially good looking code, but hey - it hopefully does it's work.

    I haven't had time to test it thoroughly, but my short tests work fine.

    Usage:

    import se.welcomweb.utils.zbase32j;
    
    public class TestZBase32J {
    
        public static void main(String ... args) {
    
            ZBase32j zbase = new ZBase32j();
    
            String message = "Hello, world!";
            String encoded = zbase.encode(message);
            System.out.println("Encoded: " + encoded);
    
            String decoded = zbase.decode(encoded);
            System.out.println("Decoded: " + decoded);
    
        }
    
    }