`assert` can be optimised away if python is run with `-O`.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Jun 11 05:32:28 UTC 2024 on atb-devel-224
"5": {"length": 43},
"6": {"length": 86},
}
- assert alg in algs
+ if alg not in algs:
+ raise ValueError(f"invalid algorithm code: {alg}"
+ f"(expected one of {','.join(algs.keys())})")
+
salt = os.urandom(16)
# The salt needs to be in [A-Za-z0-9./]
# base64 is close enough and as we had 16