token-identifier 0.1.0

A library to create 32 bit tokens with checkbits and identifier of such tokens
Documentation
  • Coverage
  • 83.33%
    15 out of 18 items documented0 out of 15 items with examples
  • Size
  • Source code size: 50.26 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.37 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 31s Average build duration of successful builds.
  • all releases: 31s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • KlausTh/token-identifier
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • KlausTh

Introduction

Goals for this implementation of tokens

  • compact representation
  • easy verbally spelling (no upper case)
  • adaptable token identifier
  • error recognition
  • restriction to ASCII chars
    • can be used in URLs without percent encoding

Token

Basic token value is a 32 bit value, plus 3 bits of error recognition. This token is represented with seven digits, each digit encoded five bits.

Example

use token_identifier::Token;

fn main() {
    let token = Token::new();

    println!("simple 32 bit token : {}", token);
}

simple 32 bit token : hfmon16

Encoding

cccvv|vvvvv|vvvvv|vvvvv|vvvvv|vvvvv|vvvvv
  • c : 3 check bits
  • v : 32 value bits
  • | : digit border

BNF

<token> ::= <digit> <digit> <digit> <digit> <digit> <digit> <digit>
<digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v

Token Identifier

Token identifier means a list of token separated with char '-'. The size of a token id is a multiple of 32 bits.

Example

use token_identifier::TokenId;

fn main() {
    let token = TokenId::new_128();

    println!("token id with 128 bits : {}", token);
}

token id with 128 bits : mht6fmh-aputm5h-5ih87pp-upc8sqc

BNF

<tokenid> ::= <token> '-' <tokenid> | <token>