okid

Crates.iookid
lib.rsokid
version0.5.3
sourcesrc
created_at2024-10-03 16:35:46.352409
updated_at2024-11-21 14:24:38.151518
descriptionA library for gereating double clickable ids
homepage
repository
max_upload_size
id1395368
size785,946
ok machina (okmachina)

documentation

README

okid

okid is a library for generating double clickable representations of various types of data, such as sha1 hashes, uuids and more.

sha1

#[cfg(feature = "sha1")]
{
    use sha1::Digest as sha1digest;
    let hasher = sha1::Sha1::new();
    let binary_id = okid::OkId::from(hasher);
}

sha256

#[cfg(feature = "sha2")]
{
    use sha2::Digest;
    let mut hasher = sha2::Sha256::new();
    hasher.update(b"hello world");
    let binary_id = okid::OkId::from(hasher);
}

The resulting strings look like this: 2ː00b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9 first character of the string is the type of the binary data in this case 2 means sha256 the rest of the string is the hexadecimal representation of the binary data

Commit count: 0

cargo fmt