keeweb / kdbxweb

Web Kdbx library
https://app.keeweb.info
MIT License
413 stars 57 forks source link

Argon2 recommendation #27

Closed perry-mitchell closed 5 years ago

perry-mitchell commented 5 years ago

Sorry to bother again! I've tried copying your argon2 code used in the test-support directory and am getting the following now:

Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value 134217728, (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with  -s ABORTING_MALLOC=0
Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value 134217728, (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with  -s ABORTING_MALLOC=0
abort("Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value 134217728, (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with  -s ABORTING_MALLOC=0 ") at Error:
    at jsStackTrace (webpack:///./source/crypto/argon2-core.js?:974:13)
    at stackTrace (webpack:///./source/crypto/argon2-core.js?:992:12)
    at abort (webpack:///./source/crypto/argon2-core.js?:8591:44)
    at abortOnCannotGrowMemory (webpack:///./source/crypto/argon2-core.js?:1020:3)
    at enlargeMemory (webpack:///./source/crypto/argon2-core.js?:1024:3)
    at Wa (webpack:///./source/crypto/argon2-core.js?:7985:32)
    at Ra (webpack:///./source/crypto/argon2-core.js?:6884:15)
    at ya (webpack:///./source/crypto/argon2-core.js?:2901:11)
    at Ga (webpack:///./source/crypto/argon2-core.js?:3376:11)
    at sa (webpack:///./source/crypto/argon2-core.js?:2538:11)
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.

We're only using kdbxweb in Node currently, so I suspect we have a number of options for an argon2 implementation. I've also seen that @antelle provides one such project. What should I be doing to allow for argon2 support in a basic Node project, if copying the example code doesn't work?

The above issue occurs immediately when calling the also-copied argon2 method, from the test-support dir.

antelle commented 5 years ago

Hi! I would suggest not using argon2-browser in node.js because it's not optimal in terms of performance. Actually the code in test-support is not very robust and it's not suitable to handle different sizes, configurations, etc... In KeeWeb I ended up with something like this, probably if you use another library for node.js, it will be easier.

Sparkenstein commented 3 months ago

The above link is dead, is argon2-browser still not recommended? is there any alternative