encodePlaintext

Encode arbitrary card plaintext into the SRA domain for SraScheme.

Prepends a 0x01 marker byte. This guarantees the encoded value is:

  • = 2 (the marker makes the high byte nonzero; for non-empty input the value is >= 256) and <= p-2 (the marker makes the high byte 0x01, where p-1's is 0xFF), so it is never 0, 1 or p-1 — which are all of the values every generated key leaves unchanged; and

  • canonically encoded (nonzero high byte), so BigInteger round-trips it without dropping leading zeros.

Apply ONCE when building the deck, before the first encryption. Recover the original bytes with decodePlaintext after the final decryption. Do NOT apply per encryption layer.

plaintext must be non-empty (an empty card has no secure SRA encoding).