Skip to main content
Version: 11.14.0

sha512

Computes a SHA-512 hash of the given string value. Uses crypto.subtle.digest when available (requires HTTPS and a modern browser), with an automatic fallback to a deterministic FNV-1a-based hash for unsupported environments.

warning

The fallback implementation is NOT cryptographically secure SHA-512. It is deterministic but should not be used for security-critical purposes in environments without crypto.subtle.

Parameters

ParameterTypeRequiredDescription
valuestringThe string to hash

Returns Promise<string> — hex-encoded 128-character hash string.

Example

sha512.ts
import { sha512 } from '@sinequa/atomic';

const hash = await sha512('hello world');
console.log(hash);
// 'ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143...'