Comments (5)
ok so the fist big issue is that you can't actually clone node crypto objects like this, but there is a reason we aren't actually using createHmac here and it's becasue it has a bunch of overhead related to streaming object creation that we didn't want which means that we probably can fix this in the library.
that being said looking at how we use the hmac and how the hmac works are you sure that applies here ?
from pbkdf2.
Sorry I removed the reference to the lines of code https://github.com/crypto-browserify/pbkdf2/blob/master/lib/sync.js#L36-L40
from pbkdf2.
from pbkdf2.
This library is pretty complex as it handles several different scenarios:
- in node.js but an old one that doesn't support some of the newer features
- the browser in synchronous mode or in browser that doesn't support webcypto
- the browser asynchronously via web crypto
so it's not necessarily obvious at first glance what code path will be taken it what environment but I believe I actually tested this back in the day and it was faster to create a node.js hmac object then to use a non streaming one because the node.js one would use a native hmac function while in the browser it wouldn't.
from pbkdf2.
Unfortunately, the Hmac class does not have the copy method as the Hash class:
But what could be pulled out of the loop is this key normalization https://github.com/crypto-browserify/pbkdf2/blob/v3.1.0/lib/sync-browser.js#L26-L30, such that the native hmac always gets the correct key length.
from pbkdf2.
Related Issues (20)
- why we need to check crypto.pbkdf2Sync.toString() ? HOT 2
- In 9.0.0, sha1 is not defaulted HOT 2
- Ripemd160 throws when used HOT 1
- Allow using this library with Uint8Array HOT 2
- How to improve the performance HOT 2
- works on browser? HOT 2
- Can I decode it?
- version change from 3.0.7 to 3.1.0 HOT 6
- pbkdf2.pbkdf2Sync('password', 'salt', 1, 32, 'sha512') returns array not string HOT 1
- The value "NaN" is invalid for option "size" HOT 2
- Uint8Array tests fail on s390x
- Incompatibility with rn-nodeify HOT 5
- Issue in pbkdf2/lib/default-encoding.js HOT 1
- process.version is undefined in lib/default-encoding.js on electron app
- pbkdf2\lib\default-encoding.js, process.version is undefine,
- In the electronic application, when I start nodeintegration, the program appears default-encoding.js? 9f9d:10 Uncaught TypeError: Cannot read property 'split' of undefined HOT 1
- pbkdf2 failing on some development environments
- pbkdf2\lib\default-encoding.js, Unexpected token (5:36) HOT 1
- Please consider upgrading the default hash function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pbkdf2.