Skip to content

Conversation

@larabr
Copy link
Collaborator

@larabr larabr commented Nov 22, 2024

See commits for details.

The improved internal tree-shaking for crypto functions helps with unused code elimination; also, md5 can be lazily load as it's used by legacy messages only. This is the impact on the lightweight build before and after the changes:

Open spoiler image image

Every submodule under the 'crypto' directory was exported-imported
even if a handful of functions where actually needed.
We now only export entire modules behind default exports if it makes
sense for readability and if the different submodules would be
imported together anyway (e.g. `cipherMode` exports are all needed
by the SEIPD class).

We've also dropped exports that are not used outside of the crypto modules,
e.g. pkcs5 helpers.
Used by old, legacy messages only
The existing md5 module brought in the util module,
which messed up the chunking structure in the lightweight build;
inlining those functions is an option, but the noble-hashes code
is also more modern and readable.
To avoid issues with the lightweight build:
for now it works fine, but it could mess up chunking in the future,
and it already results in a circular import.
Import single functions instead of entire lib.
@larabr larabr requested a review from twiss November 22, 2024 14:06
Copy link
Member

@twiss twiss left a comment

Choose a reason for hiding this comment

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

👍 Cool, thanks!

@larabr larabr merged commit b2bd8a0 into openpgpjs:main Nov 25, 2024
13 checks passed
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.

2 participants