ChaCha20

Interface to ChaCha20(-Poly1305) cipher

pyflocker.ciphers.interfaces.ChaCha20.new(encrypting: bool, key: bytes, nonce: bytes, *, use_poly1305: bool = True, file: io.BufferedIOBase | None = None, backend: Backends | None = None) base.BaseNonAEADCipher | base.BaseAEADCipher | FileCipherWrapper[source]

Instantiate a new ChaCha20-Poly1305 cipher wrapper object.

Parameters:
  • encrypting – True is encryption and False is decryption.

  • key – The key for the cipher.

  • nonce – The Nonce for the cipher. It must not be repeated with the same key.

Keyword Arguments:
  • use_poly1305 – Whether Poly1305 MAC will be used or not. Default is True.

  • file – The source file to read from.

  • backend – The backend to use. It must be a value from Backends.

Returns:

ChaCha20-(Poly1305) cipher from the appropriate backend module.

Note

Any other error that is raised is from the backend itself.