Skip to content

Conversation

@lionel-rowe
Copy link

@lionel-rowe lionel-rowe commented Nov 2, 2025

Same as CorentinTh#1152:

  • Switched from sync to async versions of the bcrypt functions.
  • Reduced max rounds to 20, as 100 is absurdly high (even 20 is absurdly high with current computing power).
  • I also added a timeout if hashing/comparing takes >10 seconds. That timeout kicks in somewhere between 16 and 17 rounds on my machine.
  • Updated visual progress/error states in the UI, including a progress bar and a message showing how long the function took to run.
  • In-progress functions are aborted if the user changes the inputs before they run to completion.

With the following changes:

  • Swapped hard-coded strings for i18n. A couple of changes to the base i18n logic were required for this, as a locale argument is required to supply to Intl.DurationFormat.
  • Bare-bones polyfill of Intl.DurationFormat as it's only baseline March 2025.
  • Update bcryptjs to 3.0.3, which includes fix: Always yield to event loop before nextTick for async versions dcodeIO/bcrypt.js#164. Older versions conditionally use process.nextTick for scheduling if it's available but setImmediate isn't, which means the event loop isn't yielded to and so the browser tab can still easily be crashed; and due to node polyfills in use, that condition was now being hit (whereas it wasn't in the CorentinTh/it-tools PR).
  • Set minimum rounds to 4 instead of 0, as bcrypt.js will automatically set it to a minimum of 4 anyway.

I didn't add polyfills for AbortSignal.any or AbortSignal.timeout, which are both baseline March 2024.

UI/interactions look like this:
bcrypt

@sharevb sharevb merged commit 669c800 into sharevb:chore/all-my-stuffs Nov 12, 2025
@sharevb
Copy link
Owner

sharevb commented Nov 12, 2025

Hi @lionel-rowe many thanks for this PR now merged

sharevb added a commit that referenced this pull request Nov 12, 2025
)

* Use async versions of bcrypt methods to avoid freezing browser tab

* Update bcryptjs to 3.0.3 and remove setInterval workaround

* extract tools strings enhancements

* i18n plugin optimization
---------

Co-authored-by: ShareVB <sharevb@gmail.com>
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