New feature: compress input before encryption #61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use gzip to compress input before encryption
Quick and dirty implementation just to see if #60 is worthwhile.
-cflag to enable. (Added this to--helpalso)node/zlibdata-cattribute in the<pre>tag. Can be extended to other compression algorithms.Results
I first tried compressing
test/test-big.htmlbut because that file is already high entropy it only compresses down to 99.82% of the input size. So I looked at the list of longass wikipedia articles and downloaded this gem to use as more plausible data.I included the page in this PR as
test/test-compress.htmlfor future reference.🥇 It compresses down to 15% 💯
Work needed
The compressed output needs to be converted to string before encryption and vice versa. We should really just feed the buffer to the crypto functions directly to avoid base64 encoding/decoding twice but I'm not smart enough to figure out how to do that.
Also, proper benchmarking