base_custom
Use any characters as your own numeric base and convert to and from decimal. This can be taken advantage of in various ways:
- Mathematics: number conversion
- Brute force sequencing
- Rolling ciphers
- Moderate information concealment
- Other potential uses such as deriving music or art from numbers
There is also a Ruby and Crystal implementation of this which this was based off of.
Installation
Add the following to your Cargo.toml file
[]
= "^0.2"
To include it for usage add
extern crate base_custom;
use BaseCustom;
to your file.
Usage
// Binary with no delimiter
let base2 = new;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
// Trinary with no delimiter
let base3 = new;
assert_eq!;
assert_eq!;
// Custom base like Musical Chords and a space delimiter
let base_music = new;
assert_eq!;
assert_eq!;
When using BaseCustom::<String>::new
the second parameter must be of Option<char>
to
choose your optional delimiter.
Benchmarks
Benchmarks are provided for the various usages and implementations. BaseCustom<char>
is
by far the most efficient implementation.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.