https://github.com/ghost1face/base62
Base62 encoder and decoder
https://github.com/ghost1face/base62
base62 c-sharp conversion netcore netstandard url-shortener
Last synced: 16 days ago
JSON representation
Base62 encoder and decoder
- Host: GitHub
- URL: https://github.com/ghost1face/base62
- Owner: ghost1face
- License: mit
- Created: 2017-09-27T02:51:27.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-11-02T00:51:12.000Z (over 3 years ago)
- Last Synced: 2025-11-16T10:20:34.152Z (7 months ago)
- Topics: base62, c-sharp, conversion, netcore, netstandard, url-shortener
- Language: C#
- Size: 41 KB
- Stars: 22
- Watchers: 2
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Base62
Base62 encoder and decoder based on [Base62 for PHP](https://github.com/tuupola/base62) for .NET. This library is useful for converting data into shortened strings good for URL shortening and/or obfuscating auto-incrementing resource ids from being exposed through RESTful APIs.
[](https://github.com/ghost1face/base62/actions/workflows/dotnet.yml) [](https://www.nuget.org/packages/Base62)
## Compatibility
Written to be netstandard compliant, this library should be able to be used cross-platform. See [netstandard](https://docs.microsoft.com/en-us/dotnet/standard/net-standard) details for more information.
## Usage
```
var base62Converter = new Base62Converter();
var encoded = base62Converter.Encode("120");
Console.WriteLine(encoded);
var decoded = base62Converter.Decode(encoded);
Console.WriteLine(decoded);
// output is:
// "DWjo"
// "120"
```
## Character sets
By default Base62 uses `[0-9A-Za-z]` character set but can be alternated to use `[0-9a-zA-Z]` through the constructor.
```
new Base62Converter(Base62Converter.CharacterSet.INVERTED);
...
```
## License
[The MIT LIcense (MIT)](./LICENSE.md).