-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate library and reccomend standardized APIs #33
Comments
ping @emn178 |
I may disagree with you when it comes to "serves little to no purpose". WebCryptoAPI requires HTTPS to work wheareas @emn178's library does work in both HTTP and HTTPS. It IS really handy. |
Realistically, in what scenario would you deploy an application without HTTPS? |
That's half the catch!
From my personal experience, those are the only three specific scenarios where this library is still greatly useful to work with. |
|
The Web Crypto API for hashing is not very good, there might be some cases for when this library might be needed, those cases being any other case than hashing an entire chunk of text at a time. |
Could you elaborate on this a little? I'd be curious if there is a specific example to this. |
There's no way to hash data in chunks (i.e create a hash object and update data). If this functionality was added I would definitely stop using this library (or any other SHA library), but for now it does have a use. |
Also, SubtleCrypto API is async-only. This library is useful where async is not allowed / not feasible, e.g. within an IndexedDB transaction (the transaction will automatically expire before the async microtask is finished and it's not always possible to pre-calculate all the required checksums beforehand). |
+1 for non-async usage. Example i want to make a universal function which would work in node and browser. I might use standard WebCrypro api, but it's async only, and my use case is synchronous (generating ids inside babel transformation). |
Well, if you are going for speed and can fit the entire file into memory, SubtleCrypto may be faster. It uses (BoringSSL/OpenSSL/whatever crypto library your browser uses)'s crypto functions under the hood (AFAIK), which may use CPU intrinsics as available to speed up the computation. On my laptop with an 11th-gen Intel i3, I can hash a 500MB Uint8Array in 723ms. But for small use cases where synchronous hashing is required, this library is nice. |
Closing this, as there obviously seems to be a common use-case for a synchronous API. |
Since the Web Crypto API is now widely supported both on the Web and Node.js this library serves little to no purpose in modern JavaScript development. This library is also very clearly no longer actively maintained.
Given these arguments I would like to propose this library be deprecated as follows:
npm deprecate
.The text was updated successfully, but these errors were encountered: