armour 0.30.22

DDL and serialization for key-value storage
Documentation
use armour::{const_hasher, types::low_id::LowId};
use data_encoding::{BASE32_NOPAD, BASE64URL_NOPAD};
use harsh::Harsh;
use sqids::{Options, Sqids};

const HARSH_ALPHABET: &[u8] = b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
const SEPARATORS: &[u8] = b"cfhistuCFHISTU";

const_hasher!(test_key, "TEST");

fn main() -> std::io::Result<()> {
    let harsh = Harsh::builder()
        .salt(b"asdasdasd")
        .length(3)
        .alphabet(HARSH_ALPHABET)
        .separators(SEPARATORS)
        .build()
        .unwrap();

    println!("generate 10 keys in hashids");
    for i in 20..30 {
        let val = harsh.encode(&[i]);
        println!("{val}");
    }

    let sqids = Sqids::new(Some(Options::new(
        Some("FxnXM1kBN6cuhsAvjW3Co7l2RePyY8DwaU04Tzt9fHQrqSVKdpimLGIJOgb5ZE".to_string()),
        Some(3),
        None,
    )))
    .unwrap();

    println!("generate 10 keys in sqids");
    for i in 20..30 {
        let val = sqids.encode(&[i]).unwrap();
        println!("{val}");
    }

    for _ in 0..10 {
        let val = LowId::<test_key::Hasher>::new(0);
        // t7r1yxyk11gx6 - 13
        println!("custom: {val}");
        let slice = &val.get().to_le_bytes()[..7];
        let val = bs58::encode(slice).into_string();
        // LnKw1FVKZ - 9
        // 111GXseB - 8
        println!("base58: {val}");
        let b64 = BASE64URL_NOPAD.encode(slice);
        // CQAA3ncOFA - 10
        println!("base64: {b64}");
        let b32 = BASE32_NOPAD.encode(slice);
        // BEAABXTXBYKA - 12
        println!("base32: {b32}");
    }

    Ok(())
}