Skip to content

Conversation

jimhark
Copy link

@jimhark jimhark commented Jul 21, 2025

Summary

cleanup getRandomAlphanum()

Fixes

Resolves #222

Details

  • Removed unneeded "& 0xff" and related comment.
  • Removed byteArray variable
  • Renamed 'parsedInt' to randByte

Notes for Reviewers

While writing this description, I noticed 2 lines that should be removed:

const myAlphaNumTestValue = getRandomAlphanum();
let byteArray;

I'll submit a follow-up pull request to remove those lines.

jimhark and others added 4 commits July 20, 2025 19:23
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.

getRandomAlphanum could use some minor cleanup
1 participant