# CryptoDigestBinding

`import { CryptoDigestBinding } from "destack:crypto/binding";`

Digest binding family.

```ds title="CryptoDigestBinding"
export interface CryptoDigestBinding {
    computeDigest(algorithm: CryptoDigestAlgorithm, payload: &'a readonly [uint8]): Result<uint8[], HostError>;
    openDigest(algorithm: CryptoDigestAlgorithm): Result<CryptoDigestHandle, HostError>;
    updateDigest(digest: CryptoDigestHandle, payload: &'a readonly [uint8]): Result<void, HostError>;
    finishDigest(digest: CryptoDigestHandle): Result<uint8[], HostError>;
    closeDigest(digest: CryptoDigestHandle): Result<void, HostError>;
}
```

[language/library/src/crypto/binding/digest.ds:11:64](https://github.com/destack-sh/destack/blob/main/language/library/src/crypto/binding/digest.ds#L11-L64)

## Members

### `computeDigest(algorithm: CryptoDigestAlgorithm, payload: &'a readonly [uint8]): Result<uint8[], HostError>`

Compute one digest in one shot.

### `openDigest(algorithm: CryptoDigestAlgorithm): Result<CryptoDigestHandle, HostError>`

Open one streaming digest context.

### `updateDigest(digest: CryptoDigestHandle, payload: &'a readonly [uint8]): Result<void, HostError>`

Update one streaming digest context.

### `finishDigest(digest: CryptoDigestHandle): Result<uint8[], HostError>`

Finalize one streaming digest context and return one digest output.

### `closeDigest(digest: CryptoDigestHandle): Result<void, HostError>`

Close one streaming digest context.
