diff options
| author | vojtechsu | 2023-12-12 13:45:08 +0100 |
|---|---|---|
| committer | vojtechsu | 2023-12-12 13:45:08 +0100 |
| commit | cee7e6b3196739b9ceaf12da3a11d5f5486b16bb (patch) | |
| tree | b2b7e46673e2e3c9d17a8eb7168bcc1764f657e3 /pyecsca/ec/formula | |
| parent | 6aa1c7213c46a3ade58f07a8082ee26108d4c0ba (diff) | |
| download | pyecsca-cee7e6b3196739b9ceaf12da3a11d5f5486b16bb.tar.gz pyecsca-cee7e6b3196739b9ceaf12da3a11d5f5486b16bb.tar.zst pyecsca-cee7e6b3196739b9ceaf12da3a11d5f5486b16bb.zip | |
Remove str.removesuffix
Diffstat (limited to 'pyecsca/ec/formula')
| -rw-r--r-- | pyecsca/ec/formula/switch_sign.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pyecsca/ec/formula/switch_sign.py b/pyecsca/ec/formula/switch_sign.py index bdf31e2..1acef5b 100644 --- a/pyecsca/ec/formula/switch_sign.py +++ b/pyecsca/ec/formula/switch_sign.py @@ -51,13 +51,15 @@ def sign_test(output_signs: Dict[str, int], coordinate_model: Any): p = 7 out_inds = set(map(lambda x: "".join([o for o in x if o.isdigit()]), output_signs)) for ind in out_inds: - point = {} + point_dict = {} for out, sign in output_signs.items(): - out_var = out.removesuffix(ind) + if not out.endswith(ind): + continue + out_var = out[:out.index(ind)] if not out_var.isalpha(): continue - point[out_var] = Mod(sign, p) - point = Point(coordinate_model, **point) + point_dict[out_var] = Mod(sign, p) + point = Point(coordinate_model, **point_dict) try: apoint = point.to_affine() except NotImplementedError: |
