Skip to content

fingerprint

Import from @varavel/vdl-plugin-sdk/utils/crypto.

function fingerprint(input): string;

Generates a short, stable, and URL-friendly 8-character hexadecimal string from any JavaScript value.

This helper is ideal for creating "pretty" identifiers, such as asset filenames, CSS class names, or unique URL slugs, where brevity and readability are prioritized over cryptographic strength.

Unlike the hash function, this returns a fixed-length string consisting only of hexadecimal characters ([0-9a-f]).

WARNING: This helper is not intended for password hashing or other security-sensitive cryptographic workflows.

Parameters

Parameter Type Description
input unknown Any JavaScript value to fingerprint (strings, numbers, objects, etc).

Returns

string

A short 8-character hexadecimal string.

Example

fingerprint({ foo: "bar", baz: "qux" });
// returns a short deterministic string such as "20665513"