newHash
newHash(
name:string,data?:string|Uint8Array<ArrayBufferLike>):HashObject
Defined in: packages/pythonlib/src/hashlib.ts:170
Create a new hash object for the given algorithm.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | Name of the hash algorithm (e.g., “sha256”, “md5”) |
data? | string | Uint8Array<ArrayBufferLike> | Optional initial data to hash |
Returns
A hash object
Example
const h = newHash("sha256")h.update("hello")console.log(await h.hexdigest())