Skip to content

Fix hashed length calculation in get_file_sha256. - #236

Open
grrrrrrrrr wants to merge 1 commit into
google:masterfrom
grrrrrrrrr:fix-get-file-sha256-len
Open

Fix hashed length calculation in get_file_sha256.#236
grrrrrrrrr wants to merge 1 commit into
google:masterfrom
grrrrrrrrr:fix-get-file-sha256-len

Conversation

@grrrrrrrrr

Copy link
Copy Markdown
Collaborator

When computing the SHA-256 digest with offset > 0, the action reported
the hashed length via file.stream_position(). This returned the absolute
stream position at EOF (offset + bytes_read) rather than the number of
bytes actually read and hashed.

This change directly accumulates the bytes read in the hashing loop and
returns that value.

When computing the SHA-256 digest with `offset > 0`, the action reported
the hashed length via `file.stream_position()`. This returned the absolute
stream position at EOF (`offset + bytes_read`) rather than the number of
bytes actually read and hashed.

This change directly accumulates the bytes read in the hashing loop and
returns that value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant