diff options
| author | Ján Jančár | 2021-02-13 11:19:45 +0100 |
|---|---|---|
| committer | GitHub | 2021-02-13 11:19:45 +0100 |
| commit | ca44c914198ecb5242d725fae512f5f5ab79c32f (patch) | |
| tree | 8d29ceab309fbc63304000e16a7389323186a1a1 | |
| parent | 51d8e29b38e641e0b4505924285a8268844895b6 (diff) | |
| parent | 491abfb548455669abd470382a48dcd07b2eda87 (diff) | |
| download | pyecsca-ca44c914198ecb5242d725fae512f5f5ab79c32f.tar.gz pyecsca-ca44c914198ecb5242d725fae512f5f5ab79c32f.tar.zst pyecsca-ca44c914198ecb5242d725fae512f5f5ab79c32f.zip | |
| -rw-r--r-- | pyecsca/ec/coordinates.py | 5 | ||||
| -rw-r--r-- | pyecsca/ec/formula.py | 5 | ||||
| -rw-r--r-- | pyecsca/ec/model.py | 2 |
3 files changed, 5 insertions, 7 deletions
diff --git a/pyecsca/ec/coordinates.py b/pyecsca/ec/coordinates.py index 299cdbf..7c76746 100644 --- a/pyecsca/ec/coordinates.py +++ b/pyecsca/ec/coordinates.py @@ -96,9 +96,8 @@ class EFDCoordinateModel(CoordinateModel): def __read_coordinates_file(self, file_path): with resource_stream(__name__, file_path) as f: - line = f.readline().decode("ascii") + line = f.readline().decode("ascii").rstrip() while line: - line = line[:-1] if line.startswith("name"): self.full_name = line[5:] elif line.startswith("variable"): @@ -120,7 +119,7 @@ class EFDCoordinateModel(CoordinateModel): elif line.startswith("assume"): self.assumptions.append( parse(line[7:].replace("^", "**"), mode="exec")) - line = f.readline().decode("ascii") + line = f.readline().decode("ascii").rstrip() def __eq__(self, other): if not isinstance(other, EFDCoordinateModel): diff --git a/pyecsca/ec/formula.py b/pyecsca/ec/formula.py index 623a52a..d0435f8 100644 --- a/pyecsca/ec/formula.py +++ b/pyecsca/ec/formula.py @@ -305,9 +305,8 @@ class EFDFormula(Formula): def __read_meta_file(self, path): with resource_stream(__name__, path) as f: - line = f.readline().decode("ascii") + line = f.readline().decode("ascii").rstrip() while line: - line = line[:-1] if line.startswith("source"): self.meta["source"] = line[7:] elif line.startswith("parameter"): @@ -317,7 +316,7 @@ class EFDFormula(Formula): parse(line[7:].replace("=", "==").replace("^", "**"), mode="eval")) elif line.startswith("unified"): self.unified = True - line = f.readline().decode("ascii") + line = f.readline().decode("ascii").rstrip() def __read_op3_file(self, path): with resource_stream(__name__, path) as f: diff --git a/pyecsca/ec/model.py b/pyecsca/ec/model.py index 4ddbafc..46b03b7 100644 --- a/pyecsca/ec/model.py +++ b/pyecsca/ec/model.py @@ -66,7 +66,7 @@ class EFDCurveModel(CurveModel): with resource_stream(__name__, file_path) as f: line = f.readline() while line: - line = line.decode("ascii")[:-1] + line = line.decode("ascii").rstrip() if line.startswith("name"): cls.name = line[5:] elif line.startswith("parameter"): |
