Expand description
§khash - Kana mnemonic hashes
This library pretty prints salted hashes of a veriaty of digests in kana. Mnemonics can be generated from slices or from streams.
It has a Rust API documented here, as well as C FFI bindings and a C header (see include/
.)
§Digest
The digests available are:
- SHA256 truncated to the first 64 bits (8 bytes) (default digest)
- SHA256 full
- CRC64 (requires “crc” default feature enabled)
- CRC32 (requires “crc” default feature enabled)
§Salting
The salting options for the digests are:
- Hard-coded embedded 32 byte salt (default)
- Fixed compile time 32 byte salt
- Fixed runtime 32 byte salt
- Dynamically sized runtime salt
- No salt
The salt (if any) is fed into the digest directly after all the data.
(See
ctx
andsalt
modules).
§Generating kana mnemonics from arbitrary data
To use the mnemonic generation algorithm on any binary data instead of just hash outputs, the Digest
iterator type is provided.
The Digest
iterator can be created from any type implementing std::io::Read
and produces a kana mnemonic reading from the stream until its end.
let input = "Hello world!";
let mnemonic: String = Digest::new(&mut input.as_bytes()).collect(); // Read the bytes from the `input` string and collect the kana mnemonic into a `String`
Modules§
- ctx
- Contains contexts used for the digest algorithms.
- error
- Error for kana-hash operation
- salt
- Salt for the digest
Context
(see modulectx
)
Structs§
- Digest
- A streaming kana hash digest.
Functions§
- generate
- Generate kana hash from a slice of bytes with this digest.
- generate_
stream - Generate kana hash from a stream of bytes with this digest.
- khash_
clone_ ⚠context - Clone a context
- khash_
clone_ ⚠salt - Clone a salt
- khash_
do ⚠ - Compute and write a kana hash output to a string.
- khash_
free_ ⚠context - Free a context
- khash_
free_ ⚠salt - Free a salt allocated with
khash_new_salt
- khash_
length ⚠ - Calculate the length in bytes of a kana hash output.
- khash_
max_ ⚠length - Find the maximum length possible for a given algorithm’s output.
- khash_
new_ ⚠context - Create a new context
- khash_
new_ ⚠salt - Create a new salt