0
Crypto.Cipher.<algorithm>.new(key, mode, *, nonce=None, mac_len=None)

Parameters:

key (bytes) – the cryptographic key

mode – the constant Crypto.Cipher.<algorithm>.MODE_GCM

nonce (bytes) – the value of the fixed nonce. It must be unique for the combination message/key. If not present, the library creates a random nonce (16 bytes long for AES).

mac_len (integer) – the desired length of the MAC tag, from 4 to 16 bytes (default: 16).

I have a question regarding the * parameter, since this is not explained in the documentation, what is that symbol? and what is it for in the method?

Community
  • 1
  • 1
Carlos Bello
  • 262
  • 4
  • 10
  • Duplicate of [Star (\*) as an argument in python function](https://stackoverflow.com/questions/53797057/star-as-an-argument-in-python-function) – wjandrea Feb 13 '20 at 14:23

1 Answers1

1

* here doesn't refer to a parameter itself - rather, it's a division between the parameters before it (which can be specified positionally or as keywords), and the parameters after it (which are keyword-only, and cannot be specified positionally).

PEP 3102 goes into more detail.

Green Cloak Guy
  • 23,793
  • 4
  • 33
  • 53