Skip to content

crypto.sha3: be big-endian friendly#24045

Merged
spytheman merged 1 commit into
vlang:masterfrom
tankf33der:sha3
Mar 25, 2025
Merged

crypto.sha3: be big-endian friendly#24045
spytheman merged 1 commit into
vlang:masterfrom
tankf33der:sha3

Conversation

@tankf33der

Copy link
Copy Markdown
Contributor

And as a result of these change, the results of sha3 will be the same across all systems, including s390x.

@huly-for-github

Copy link
Copy Markdown

Connected to Huly®: V_0.6-22436

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect. Less code, with more platforms supported 🥳.

@spytheman spytheman merged commit f7f89b3 into vlang:master Mar 25, 2025
@medvednikov

Copy link
Copy Markdown
Member

Can you please explain why this change works for big endian systems?

@spytheman

Copy link
Copy Markdown
Contributor

Because it always writes in the same order.

@spytheman

spytheman commented Mar 25, 2025

Copy link
Copy Markdown
Contributor

The methods that are fixed by the PR are to_bytes and from_bytes, i.e. they are serialization/unserialization related ones, and the needed swapping is already done in little_endian_put_u64_at.

@medvednikov

Copy link
Copy Markdown
Member

I see, thanks.

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.

3 participants