Telehashname v0.0.3 Telehashname
Telehash hashname handling
https://github.com/telehash/telehash.org/blob/master/v3/hashname.md
Summary
Functions
Find the highest rated match among two CSK lists
Generate a hashname from a list of CSKs
Generate a hashname from intermediates
Validate and sort a CSID list
Determine if something looks like a valid hashname
Determine if something looks like a valid CSID
Types
csid :: binary
Cipher Set ID
As an affordance, many functions will take a 4-byte CSID (the CSID with a pre-pended cs
.)
These will be normalized in most return values. It is not recommended to depend upon this
behavior.
csk_list :: [csk_tuple] | map
A list of CSKs
Maps will generally be transformed to a list of CSK tuples in the return values.
sort_dir :: :asc | :dsc
Sort direction control
- :asc == ascending
- :dsc == descending
Functions
Find the highest rated match among two CSK lists
The values returned from the outs
list. Selecting
which list to use for check
and outs
may provide
some useful information “for free.”
Specs
from_csks(csk_list, map) :: {binary, map} | nil
Generate a hashname from a list of CSKs
As an affordance, an intermediates map may also be provided.
The return value is a tuple with the hashname and a map of the intermediate values used for generation.
nil
is returned when no valid CSKs are found in the list.
Specs
from_intermediates(csk_list | map) ::
{binary, map} |
nil
Generate a hashname from intermediates
Validate and sort a CSID list
This can handle multiple forms of provided CSIDs. The return value will be appropriate to the input parameter.
Invalid CSIDs are removed, remaining IDs are normalized and sorted in the requested order.
Specs
is_valid?(term) :: boolean
Determine if something looks like a valid hashname
Confirms form only, not validity