🔐 Computes the SHA-512 hash of a string, returning a hex string.

Info

Always returns a `Promise`. Uses the standard Web Crypto API (`crypto.subtle`).

Syntax

TypeScript
import { sha512 } from '@opentf/std';

sha512(input: string): Promise<string>;

Parameters

NameTypeDescription
inputstringThe string to hash.

Returns

A hex-encoded SHA-512 hash string (128 characters).

Examples

TypeScript
await sha512('hello')
//=> '9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043'
Last updated on
Edit this page