# Method Nettle.BufferedCipher()->Buffer.State()->pad()

Method pad

  `string(8bit) pad(void|int method)`

Description

  Pad and encrypt any data left in the buffer. The output data is not automatically memory scrubbed, unless String.secure is called on the data.

Parameter `method`

  The type of padding to apply to the buffer.

  `Crypto.PAD_ISO_10126` | Pads according to ISO 10126, which means filling all extra space with random data and putting the size of the non-payload data last.
  `Crypto.PAD_TLS` | Pads according to RFC 5246 section 6.2.3.2, meaning that all extra space is filled with the size of the padding. Note that this size has an off by one difference to the other schemas, so 0 means 1 byte of padding.
  `Crypto.PAD_SSL`
  `Crypto.PAD_ANSI_X923` | Pads according to ANSI X.923, which means filling all extra space with zero and putting the size of the non-payload data last.
  `Crypto.PAD_PKCS7` | Pads according to PKCS7 / RFC 3852, which means filling all extra space with the size of the extra space.
  `Crypto.PAD_ZERO` | Fills the extra space with null bytes. To correctly remove the padding the clear text data must not end with a null byte. In that case the data would have to be manually padded/unpadded before/after calling crypt().

  Defaults to Crypto.PAD_SSL for compatibility reasons.

See also

  unpad()