# ciphertextLengthForPlaintext

> **ciphertextLengthForPlaintext**(`plaintextLength`, `chunkSize`): `number`

Defined in: [packages/filecoin-encryption-envelope/src/chunk-layout.ts:147](https://github.com/FilOzone/synapse-sdk/blob/bc8a4b093324ccef9b407251fcf4e91823c6f599/packages/filecoin-encryption-envelope/src/chunk-layout.ts#L147)

Detached ciphertext length a plaintext of `plaintextLength` bytes produces
at `chunkSize`: `P + 16 × max(1, ceil(P / S))`, one tag per chunk.

This is what makes a declared `plaintext_length` checkable. The mapping is
strictly increasing in `P`, so one ciphertext length admits exactly one
valid `P` — which holds only because the profile permits a single
final-chunk form (see [chunkLayout](/reference/filoz/filecoin-encryption-envelope/namespaces/chunklayout/functions/chunklayout/)). An unsafe result is rejected
rather than returned: past `Number.MAX_SAFE_INTEGER` a length rounds
silently instead of failing.

## Parameters

| Parameter | Type |
| ------ | ------ |
| `plaintextLength` | `number` |
| `chunkSize` | `number` |

## Returns

`number`