#sha-1 #identifier #representation #uuid #data #hash #ids

okid

A library for gereating double clickable ids

12 releases

new 0.1.39 Nov 6, 2024
0.1.38 Nov 6, 2024
0.1.37 Oct 21, 2024

#457 in Cryptography

Download history 525/week @ 2024-10-03 236/week @ 2024-10-10 228/week @ 2024-10-17 26/week @ 2024-10-24 118/week @ 2024-10-31

651 downloads per month

BSD-3-Clause

730KB
959 lines

okid

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

sha1

use sha1::Digest as sha1digest;
let hasher = sha1::Sha1::new();
let binary_id = okid::OkId::from(hasher);

sha256

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


lib.rs:

okid is a library for generating cannocial self-describing binary identifiers for git commits, sha1, sha256, sha512 hashes, ULIDs, UUIDs, datatime, extended, and random identifiers, etc. okid binary identifier

Examples

sha1

use sha1::Digest as sha1digest;
let hasher = sha1::Sha1::new();
let binary_id = okid::OkId::from(hasher);

sha256

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

Dependencies

~12–27MB
~407K SLoC