Base32

Base32 Encoding and Decoding - Base32

Introduction

Base32 is a method of representing 256 ASCII codes using 32 specific ASCII codes (2 to the power of 5). Therefore, after Base32 encoding, 5 ASCII characters will become 8 characters (a common multiple of 40), increasing the length by 3/5. If the length is not a multiple of 8, it will be padded with “=”.

Usage

String a = "伦家是一个非常长的字符串";

String encode = Base32.encode(a);
Assert.assertEquals("4S6KNZNOW3TJRL7EXCAOJOFK5GOZ5ZNYXDUZLP7HTKCOLLMX46WKNZFYWI", encode);

String decodeStr = Base32.decodeStr(encode);
Assert.assertEquals(a, decodeStr);