Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GR-52534] Change digest algorithm and encoding. #8772

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

graalvmbot
Copy link
Collaborator

Digests are used in multiple places in the image generator, from lambda names to factory method names to symbol names. Shorter digests, and shorter "unique short names", therefore mean smaller image size.

This PR changes the digest from SHA-1 encoded as a hex string (40 bytes) to 128-bit Murmur3 as a Base-62 string (22 bytes). We do not use a standard Base64 encoding because Base64 needs 2 special characters in addition to numbers and letters, and there are no 2 characters that work universally everywhere (Java names, symbol names, ...). We also don't care about encoding speed and never need to decode, so a non-standard encoding does not matter at all.

There is no need for the hash algorithm to be cryptographic. In the worst case, image build can fail because two symbol names are no longer unique. For many usages, there is already a conflict resolution policy in place because the digested input strings themselves are not guaranteed to be unique. A non-cryptographic algorithm also avoids false-positive flagging of the old SHA-1 as a weak cryptographic algorithm without moving to an even longer SHA-2 hash.

In addition, there are a few other tweaks that shorten "unique short names", like capping the length of class names, removing the unnecessary constructor literal for constructors, greatly shortening the deoptimization entry point marker, ...

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Apr 15, 2024
@graalvmbot graalvmbot closed this Apr 18, 2024
@graalvmbot graalvmbot merged commit 65f6120 into master Apr 18, 2024
13 checks passed
@graalvmbot graalvmbot deleted the cwi/GR-52534-digest branch April 18, 2024 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants