Zero-copy, no-std proquint encoding and decoding

Overview

proqnt

Version Documentation Build License Downloads

A pronounceable quintuplet, or proquint, is a pronounceable 5-letter string encoding a unique 16-bit integer.

Proquints may be used to encode binary data such as IP addresses, public keys, and UUIDs in a more human-friendly way. For more information, check out the specification

Basic Usage

# use std::net::Ipv4Addr;
use proqnt::{FromProquints, IntoProquints, Proquint};
assert_eq!(
    format!("{}", Ipv4Addr::new(127, 0, 0, 1).proquint_encode()),
    "lusab-babad"
);
assert!(
    Ipv4Addr::new(127, 0, 0, 1).proquint_digits().eq([
        u16::parse_proquints("lusab").unwrap(),
        u16::parse_proquints("babad").unwrap()
    ].into_iter())
);
assert_eq!(
    format!("{}", [127u8, 0, 0, 1].proquint_encode()),
    "lusab-babad"
);
assert!(
    Ipv4Addr::new(127, 0, 0, 1).proquint_encode().into_iter().eq([
        "lusab".parse::<Proquint>().unwrap(),
        "babad".parse::<Proquint>().unwrap()
    ].into_iter())
);
// NOTE: [127, 0, 0, 1] will yield an array of i32, which will give the wrong result!
You might also like...
Parse and encoding of data using the SCTE-35 standard.

SCTE-35 lib and parser for Rust Work in progress! This library provide access to parse and encoding of data using the SCTE-35 standard. This standard

Efficiently store Rust idiomatic bytes related types in Avro encoding.

Serde Avro Bytes Avro is a binary encoding format which provides a "bytes" type optimized to store &[u8] data like. Unfortunately the apache_avro enco

A turing-complete programming language using only zero-width unicode characters, inspired by brainfuck and whitespace.

Zero-Width A turing-complete programming language using only zero-width unicode characters, inspired by brainfuck and whitespace. Currently a (possibl

A set of Zero Knowledge modules, written in Rust and designed to be used in other system programming environments.

Zerokit A set of Zero Knowledge modules, written in Rust and designed to be used in other system programming environments. Initial scope Focus on RLN

Code to follow along the "Zero To Production" book on API development in Rust.

Zero To Production / Code (Chapter 10 - Part 1) Zero To Production In Rust is an opinionated introduction to backend development using Rust. This repo

Curdleproofs is a zero-knowledge shuffle argument
Curdleproofs is a zero-knowledge shuffle argument

Curdleproofs Curdleproofs is a zero-knowledge shuffle argument inspired by BG12. Zero-knowledge shuffle arguments can have multiple use cases: Secret

A pure-rust(with zero dependencies) fenwick tree, for the efficient computation of dynamic prefix sums.

indexset A pure-rust(with zero dependencies, no-std) fenwick tree, for the efficient computation of dynamic prefix sums. Background Did you ever have

An API for getting questions from http://either.io implemented fully in Rust, using reqwest and some regex magic. Provides asynchronous and blocking clients respectively.

eithers_rust An API for getting questions from http://either.io implemented fully in Rust, using reqwest and some regex magic. Provides asynchronous a

Comments
  • Crate generates inappropiate words in some cases

    Crate generates inappropiate words in some cases

    It may worth a mention in the docs that Proquints could generate profanities in some cases. Just to ensure people are not integrating this library in places where those identifier would cause trouble.

    Example:

    use proqnt::IntoProquints;
    
    fn main() {
        println!(
            "{}",
            [0x04ED, 0x20ED, 0x3DC3, 0x8AE9, 0x93DC, 0x94CC, 0xAF59, 0xC868, 0xEA1D]
                .into_iter()
                .map(|x: u16| x.proquint_encode().to_string())
                .collect::<Vec<_>>()
                .join(", ")
        );
    }
    
    opened by xTibor 1
Owner
Jad Ghalayini
CS PhD student supervised by Neel Krishnaswami, working on refinement types and intermediate representations
Jad Ghalayini
A tool to deserialize data from an input encoding, transform it and serialize it back into an output encoding.

dts A simple tool to deserialize data from an input encoding, transform it and serialize it back into an output encoding. Requires rust >= 1.56.0. Ins

null 11 Dec 14, 2022
A minimal and fast zero-copy parser for the PE32+ file format.

peview A minimal and fast zero-copy parser for the PE32+ file format. Goal This project aims to offer a more light weight and easier to use alternativ

null 5 Dec 20, 2022
Rust library for concurrent data access, using memory-mapped files, zero-copy deserialization, and wait-free synchronization.

mmap-sync mmap-sync is a Rust crate designed to manage high-performance, concurrent data access between a single writer process and multiple reader pr

Cloudflare 97 Jun 26, 2023
A tiny Rust std-lib for Linux x86_64 and aarch64

Tiny std Like a bad, probably buggy, tiny standard library for Linux. When it's appropriate If you are actually trying to do something solid, checkout

null 4 Dec 17, 2022
An extension to Rust std for beginner exercises

note: this is for practicing rust only, do not use this in actual production programs! really, don't. [dependencies] simple-std = "0.1.1" simple-std i

nils 2 Jan 2, 2022
A Rust no-std (de)compressor based on PAQ

MASHI まし A 100% no-std compatible Rust implementation of a PAQ style arithmetic coding, context mixing compressor. Its intended use case is compressin

null 7 Dec 14, 2022
Additional Rust collections not found in std::collections

More collections Rust crate with additional collections not found in std::collections. Multimaps Completion Name Behaves like ?? ?? ?? ⬜️ ⬜️ HashSetMu

Rinde van Lon 4 Dec 21, 2022
A no-std esp32 Wifi Lamp

Nostd-wifi-lamp A Wi-Fi controllable lamp written in Rust for the ESP32 using esp-hal. This was created for a blog post you can read here. Usage Sadly

null 9 Apr 30, 2023
A personally annotated copy of the "The Rust Programming Language"

Rust Book This is a personally annotated copy of the "The Rust Programming Language"1. Why Rust For me, I've never really been exposed to low-level sy

Matan Lurey 3 Nov 1, 2022
Rust Vector for large amounts of data, that does not copy when growing, by using full `mmap`'d pages.

Large Vector Rust Vector for large amounts of data, that does not copy when growing, by using full mmap'd pages. Maturity I made ths to learn about mm

Wonko der Verständige 21 Apr 23, 2024