staticrypt
staticrypt copied to clipboard
Prefer Uint8Array as internal representation of binary data
Summary
Use Uint8Array to store binary data. This is a major refactor based on number of lines, but low in complexity, most of the changes are almost mechanical.
Resolves
Resolves #215, #216, #217, #218
Details
- The big change is to prefer Uint8Array for holding binary data
- Hex strings are converted to Uint8Array on input
- Uint8Aarray is converted hex strings for output where needed
- API calls that accept binary data no longer need conversion from hex strings
- For large files, memory use is greatly reduced
- For large files, speed in noticeably improved
Testing
I manually tested node encrypt, node decrypt, and HTML wrapper decrypt.
Notes for Reviewers
The scope should have been limited strictly to the switch from hex strings to Uint8Array, but I included other changes related to memory reduction. I admit that was a mistake. I regret including these smaller changes which should have been separate commits:
- #216
- #217
- #218