ARCcore.identifier provides functions for generating 22-character, 128-bit unique identifiers called Internet Routable URI Tokens (IRUT's) from in-memory data. Or, from a random v4 UUID.
When generating an IRUT from in-memory data, the Murmur3 non-cryptographic digest hash algorithm is used to create a 128-bit numerical value using the murmurhash-js package.
When generating a random IRUT, the 128-bit numerical value is obtained using the uuid package.
In both cases the 128-bit numerical value is converted to an IRUT by:
=
characters from the end of base64 string/
characters with _
(underscore)+
characters with -
(hypen)The character substitutions are made to ensure that IRUT strings do not contain any of the characters reserved by the Universal Resource Identifier specification. See: RFC3986 (section 2.3).
Infrequently used but occasionally useful (e.g. tiny URL's), ARCcore.identifier additionally provides a variant of the algorithm above for generating 6-character, 32-bit unique IRUT strings.
$ node
> const arccore = require('arccore');
undefined
> arccore.identifier
{ hash:
{ fromUTF8: [Function],
fromReference: [Function],
toIRUT: [Function] },
irut:
{ fromEther: [Function],
fromReference: [Function],
isIRUT: [Function] } }
>
Note that at present, the ARCcore distribution package bundles both the
murmurhash-js and uuid
packages via webpack so as to maintain zero external dependencies. If you're
using the ARCcore package, save space by picking up these dependencies via convenience export namespace
arccore.__bundle
.