diff options
| author | J08nY | 2024-07-16 15:53:51 +0200 |
|---|---|---|
| committer | J08nY | 2024-07-16 15:53:51 +0200 |
| commit | d6fc0ada881aad78543124bd2ffb63ce187b4e0f (patch) | |
| tree | f74515f8e17f58a6c52e93559bc468a65062ca1b /pyecsca | |
| parent | 8b3999171f5578c12bc7843dc01b0d27f9be54dd (diff) | |
| download | pyecsca-d6fc0ada881aad78543124bd2ffb63ce187b4e0f.tar.gz pyecsca-d6fc0ada881aad78543124bd2ffb63ce187b4e0f.tar.zst pyecsca-d6fc0ada881aad78543124bd2ffb63ce187b4e0f.zip | |
Use faster symbol.name instead of str(symbol).
Diffstat (limited to '')
| -rw-r--r-- | pyecsca/ec/formula/base.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pyecsca/ec/formula/base.py b/pyecsca/ec/formula/base.py index 41915d9..04d6c19 100644 --- a/pyecsca/ec/formula/base.py +++ b/pyecsca/ec/formula/base.py @@ -173,7 +173,7 @@ class Formula(ABC): used_symbols = sorted(expr.free_symbols) used_params = [] for symbol in used_symbols: - if (value := params.get(str(symbol), None)) is not None: + if (value := params.get(symbol.name, None)) is not None: used_params.append(value) if isinstance(value, SymbolicMod): expr = expr.xreplace({symbol: value.x}) @@ -200,14 +200,14 @@ class Formula(ABC): expr = sympify(f"{rhs} - {lhs}", evaluate=False) remaining = [] for symbol in expr.free_symbols: - if (value := params.get(str(symbol), None)) is not None: + if (value := params.get(symbol.name, None)) is not None: if isinstance(value, SymbolicMod): expr = expr.xreplace({symbol: value.x}) else: expr = expr.xreplace({symbol: int(value)}) else: remaining.append(symbol) - if len(remaining) > 1 or (param := str(remaining[0])) not in self.parameters: + if len(remaining) > 1 or (param := remaining[0].name) not in self.parameters: raise ValueError( f"This formula couldn't be executed due to an unsupported assumption ({assumption_string})." ) |
