ciphertextLengthForPlaintext
ciphertextLengthForPlaintext(
plaintextLength,chunkSize):number
Defined in: packages/filecoin-encryption-envelope/src/chunk-layout.ts:147
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). An unsafe result is rejected
rather than returned: past Number.MAX_SAFE_INTEGER a length rounds
silently instead of failing.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
plaintextLength | number |
chunkSize | number |
Returns
Section titled “Returns”number