kittenmoji

Crates.iokittenmoji
lib.rskittenmoji
version0.1.1
sourcesrc
created_at2024-09-16 17:38:15.289076
updated_at2024-09-19 18:31:39.042553
descriptionA crate to encode and decode kittenmoji.
homepage
repositoryhttps://gitlab.com/GKnirps/kittenmoji-rust
max_upload_size
id1376649
size66,187
(GKnirps)

documentation

README

KittenMoji

This is a KittenMoji encoder/decoder written in rust.

This crate is written in 100% safe rust and has no external dependencies.

What is KittenMoji?

KittenMoji is a base 256 binary-to-text encoding that uses emojis as encoding units. It originates from the Small Web development kit Kitten, where it is used to encode cryptographic keys.

Why?

You can say a lot of things against KittenMoji. For example, it is terribly inefficient. Even a hexadecimal binary-to-text encoding encodes each byte as only two bytes. KittenMoji, encoded as utf-8, uses 4 bytes per byte.

However, it looks nice, it's kind of cute and someone on Mastodon pointed out that many platforms with character limits (e.g. Mastodon) count emojis as only one character.

Personally, I just wrote this crate for the joy of it, not for any practical use.

Usage

Example usage in rust code

let kitten_encoded = encode_slice(b"kitten");
assert_eq!(kitten_encoded, "πŸ§¬πŸŽ­πŸŒΊπŸŒΊπŸπŸ’");

let kitten_decoded = decode_str("πŸ§¬πŸŽ­πŸŒΊπŸŒΊπŸπŸ’").unwrap();
assert_eq!(kitten_decoded, b"kitten");

Example binaries

There are two example binaries: encode and decode. They take input from stdin, encode/decode it and write the result to stdin. Both have a constant memory footprint and can be used to encode or decode large files.

echo -n "kitten" | cargo run --release --example encode

License

This project is licensed under the GNU Affero General Public License.

Commit count: 18

cargo fmt