https://github.com/seruco/base62
Base62 Encoder/Decoder for Java
https://github.com/seruco/base62
base62 encoding encoding-library encodings java
Last synced: 18 days ago
JSON representation
Base62 Encoder/Decoder for Java
- Host: GitHub
- URL: https://github.com/seruco/base62
- Owner: seruco
- License: mit
- Created: 2017-12-10T19:13:08.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-12-25T11:14:14.000Z (about 6 years ago)
- Last Synced: 2025-07-23T03:47:41.025Z (6 months ago)
- Topics: base62, encoding, encoding-library, encodings, java
- Language: Java
- Homepage:
- Size: 51.8 KB
- Stars: 61
- Watchers: 1
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Base62 []()
**A Base62 Encoder/Decoder for Java**
## Getting Started
For Maven-based projects, add the following to your `pom.xml` file. This dependency is available from the Maven Central repository.
```xml
io.seruco.encoding
base62
0.1.3
```
## Usage
```java
Base62 base62 = Base62.createInstance();
```
### Encoding
```java
final byte[] encoded = base62.encode("Hello World".getBytes());
new String(encoded); // is "73XpUgyMwkGr29M"
```
### Decoding
```java
final byte[] decoded = base62.decode("73XpUgyMwkGr29M".getBytes());
new String(decoded); // is "Hello World"
```
## Character Sets
This library supports two character sets: GMP-style or inverted. The difference between these two is whether the upper case letters come first, `0-9A-Za-z` (GMP), or last, `0-9a-zA-Z` (inverted).
By default, we prefer the GMP-style character set. If you want to use the inverted character set, simply do this:
```java
Base62 base62 = Base62.createInstanceWithInvertedCharacterSet();
```
## Licensing
This project is licensed under the [MIT License](LICENSE).