said-0.1.0 has been yanked.
Self-Addressing Identifier
Self-Addressing Identifier (SAI) provides a compact text representation of digests of data. It supports multiple hash algorithms.
Self Addressing Identifier is base64 encoded hash of data, prepended with one or two letter prefix, called derivation code. Derivation code determines which hash algorithm was used to derive the digest.
| derivation code | digest type | code length | identifier length |
|---|---|---|---|
| E | Blake3-256 Digest | 1 | 44 |
| F | Blake2b-256 Digest | 1 | 44 |
| G | Blake2s-256 Digest | 1 | 44 |
| H | SHA3-256 Digest | 1 | 44 |
| I | SHA2-256 Digest | 1 | 44 |
| 0D | Blake3-512 Digest | 2 | 88 |
| 0E | Blake2b-512 Digest | 2 | 88 |
| 0F | SHA3-512 Digest | 2 | 88 |
| 0G | SHA2-512 Digest | 2 | 88 |
Usage
To derive Self Addressing Identifier, SelfAddressing enum can be used. It
determines hashing algorithm used for Identifier derivation. Here are its
possible values:
verify_bindings function checks if provided data matches digest encoded in Self Addressing Identifier.
Example
let data = "hello there";
let sai = Blake3_256.derive;
assert_eq!;
assert!;
assert!;
wasm
bindings/sai_wasm directory contains a project which allows to compile sai library to wasm.