Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brian3647/conv64
A simple base64 ID generator for your projects
https://github.com/brian3647/conv64
Last synced: about 13 hours ago
JSON representation
A simple base64 ID generator for your projects
- Host: GitHub
- URL: https://github.com/brian3647/conv64
- Owner: Brian3647
- License: mit
- Created: 2021-12-21T15:50:35.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-11T13:09:17.000Z (12 months ago)
- Last Synced: 2024-10-14T01:46:24.185Z (24 days ago)
- Language: Rust
- Homepage: https://crates.io/crates/conv64
- Size: 19.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
README
# conv64
Easily (& blazingly fast) convert base 10 numbers to base 64.
**IMPORTANT NOTE: This is base 64 as in the number base, if you're searching for base64 encryption, use [this](https://crates.io/crates/base64)**
## Quickstart
```toml
# Cargo.toml
[dependencies]
conv64 = "*"
``````rust
// main.rs
fn main() {
let x = conv64::encode(1234567890);
println!("{}", x); // 19bWBI// With the `rand` feature enabled:
let y = conv64::generate(1..2000);
println!("{}", y); // A random number between 1 and 2000, encoded in base 64// Get the maximum value a base 64 number can have with a given number of letters
assert_eq!(conv64::max_value_for_letters(1), Some(63));
}
```## Uses
The main application for this is using it as an ID generator/shortener (for example, YouTube video IDs are base 64 encoded numbers).
Since its main use is for the web, the 2 extra characters (`+` and `/`) are replaced with `-` and `_` respectively, so it can be used in URLs without encoding.
## License
This project is licensed under the [MIT License](LICENSE).