Skip to content

hash

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

function hash(input): string;

Hashes any JavaScript value into a deterministic string.

The value is serialized first and then hashed, which makes this helper useful for cache keys, content fingerprints, and change detection inside plugins.

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 hash (strings, numbers, objects, etc).

Returns

string

A stable hash string for the provided input.

Example

hash({ foo: "bar", baz: "qux" });
// returns a deterministic hash string such as "9nMwOfcM8M06tjTZT0Uu68tWDaJQ_rmW6b9nZ1VRoAg"

See

Powered by ohash (MIT): https://github.com/unjs/ohash