Skip to content

Conversation

jimhark
Copy link

@jimhark jimhark commented Jul 21, 2025

Summary

Freshen up the browser version of HexEncoder

Resolves

resolves #220

Details

  • parse()
    • simplify var names
    • Minor reformatting
    • Throw Error() object, not string
  • stringify()
    • Pad hex using .padStart(2, "0")

Testing

I manually tested node encrypt, node decrypt, and HTML wrapper decrypt.

jimhark and others added 3 commits July 20, 2025 18:40
This is part of a push to support larger files. The focus is the switch
to using Uint8Array to store binary data. But also includes:

- When running on Node, use Buffer.from() for hex string conversions.

- To avoid large buffer copy, signedMsg as been replaced by an object
    containing  iv, encrypted, and hmac.

- hmac calculation has changed so it avoids copying (possibly very
    large) encrypted data. See signDigest() in lib/codec.js.

- Minor cleanup

Handling hex encode/decode at the input/output boundaries and using
Uint8Array internally for representing binary data has these benefits:

- More memory efficient, allows processing of 2x larger files.

- Aligns with cryptographic best practices: hashing is now performed
  on raw binary data (Uint8Array) instead of hex strings.

- Behavior is (mostly) unchanged
  - scripts/index_template.html textContent is not implemented and
    needs to be redesigned.
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.

Cleanup browser version of HexEncoder
1 participant