Crates.io | token-identifier |
lib.rs | token-identifier |
version | 0.1.0 |
source | src |
created_at | 2024-09-27 07:47:01.625471 |
updated_at | 2024-09-27 07:47:01.625471 |
description | A library to create 32 bit tokens with checkbits and identifier of such tokens |
homepage | |
repository | https://github.com/KlausTh/token-identifier |
max_upload_size | |
id | 1388373 |
size | 50,768 |
Goals for this implementation of tokens
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.
use token_identifier::Token;
fn main() {
let token = Token::new();
println!("simple 32 bit token : {}", token);
}
simple 32 bit token : hfmon16
cccvv|vvvvv|vvvvv|vvvvv|vvvvv|vvvvv|vvvvv
<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 means a list of token separated with char '-'. The size of a token id is a multiple of 32 bits.
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
<tokenid> ::= <token> '-' <tokenid> | <token>