Skip to content

HashObject

Defined in: packages/pythonlib/src/hashlib.ts:18

Hash object interface mimicking Python’s hash object. Note: digest() and hexdigest() are async to support Web Crypto API.

Properties

blockSize

readonly blockSize: number

Defined in: packages/pythonlib/src/hashlib.ts:24

Internal block size in bytes


digestSize

readonly digestSize: number

Defined in: packages/pythonlib/src/hashlib.ts:22

Digest size in bytes


name

readonly name: string

Defined in: packages/pythonlib/src/hashlib.ts:20

Name of the hash algorithm

Methods

copy()

copy(): HashObject

Defined in: packages/pythonlib/src/hashlib.ts:32

Return a copy of the hash object

Returns

HashObject


digest()

digest(): Promise<Uint8Array<ArrayBufferLike>>

Defined in: packages/pythonlib/src/hashlib.ts:28

Return the digest as bytes (async)

Returns

Promise<Uint8Array<ArrayBufferLike>>


hexdigest()

hexdigest(): Promise<string>

Defined in: packages/pythonlib/src/hashlib.ts:30

Return the digest as a hexadecimal string (async)

Returns

Promise<string>


update()

update(data: string | Uint8Array<ArrayBufferLike>): void

Defined in: packages/pythonlib/src/hashlib.ts:26

Update the hash with data (sync - buffers data)

Parameters

ParameterType
datastring | Uint8Array<ArrayBufferLike>

Returns

void