API reference › @evolu/common › Crypto › createPadmePaddedLength

function createPadmePaddedLength(
  length: number &
    Brand<"NonNaN"> &
    Brand<"Finite"> &
    Brand<"Int"> &
    Brand<"NonNegative">,
): number &
  Brand<"NonNaN"> &
  Brand<"Finite"> &
  Brand<"Int"> &
  Brand<"NonNegative">;

Defined in: packages/common/src/Crypto.ts:365

Returns the PADMÉ padded length for a given input length.

PADMÉ limits information leakage about the length of the plain-text for a wide range of encrypted data sizes.

See the PURBs paper for details: https://bford.info/pub/sec/purb.pdf

Throws for a length above 2^53 - 2^46, whose padded length would exceed Number.MAX_SAFE_INTEGER.