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
| Parameter | Type | Required | Description |
|---|---|---|---|
value | string | ✓ | The 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...'