Skip to content

Commit

Permalink
fix(pyd): remove usedforsecurity hash flag for py3.8
Browse files Browse the repository at this point in the history
Signed-off-by: Braden Mars <bradenmars@bradenmars.me>
  • Loading branch information
BradenM committed Apr 17, 2023
1 parent 90b1547 commit 522a0c3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion micropy/pyd/backend_upydevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def read_file(
consumer.on_start(
name=f"Reading {Path(target_path).name} (xsize: {chunk_size})", size=int(content_size)
)
hasher = hashlib.sha256(usedforsecurity=False)
hasher = hashlib.sha256()
while pos < content_size:
try:
cmd = read_chunk_cmd.format(path=str(target_path), pos=pos, chunk_size=chunk_size)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pyd.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def test_read_file__with_integrity(self, mock_upy_retry, pymock):
m.mock_uos.return_value.stat.side_effect = ["ENOENT", [0, 0, 0, 0, 0, 0, 8]]
# chunk size will default to 8/4
chunks = [b"Hi", b" t", b"he", b"re"]
chunks_hash = hashlib.sha256(usedforsecurity=False)
chunks_hash = hashlib.sha256()
for chunk in chunks:
chunks_hash.update(chunk)
m.device.cmd.side_effect = [8, *chunks, chunks_hash.hexdigest()]
Expand Down

0 comments on commit 522a0c3

Please sign in to comment.