Skip to main content
@spa-tools/utilities

hash()

The hash() function simply hashes the provided value using the browser's sha256 crypto algorithm.

Usage

import { hash } from '@spa-tools/utilities';

const value = { baz: 123, foo: 'bar' };
const hashedValue = hash(value);

console.log(hashedValue);
// -> 'fdf216617c29ad5894de2528e51f783392a864c38ab4d0411a0ac59435621afd'

Arguments

NameTypeRequired?DefaultDescription
valueunkownyes-The value to hash

Returns

string - The hashed value.