Appearance
hash
Functions
hash()
ts
function hash(text, type?): string;Defined in: src/node/hash.ts:13
Creates a hex hash of text using Node.js crypto.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
text | string | Buffer<ArrayBufferLike> | undefined | Text or Buffer to hash. |
type | string | 'sha256' | Hash algorithm (default: 'sha256'). |
Returns
string
Hex-encoded hash string.
Example
ts
hash('hello'); // => '2cf24dba...' (sha256)
hash('hello', 'md5'); // => '5d41402a...'