antelle / argon2-browser

Argon2 library compiled for browser runtime
https://antelle.net/argon2-browser
MIT License
377 stars 81 forks source link

Unable to reproduce argon2.wasm file found on website #87

Open blake-regalia opened 1 year ago

blake-regalia commented 1 year ago

Building from the master branch with the latest emsdk produces a completely different binary than what is hosted on the demo website. At cursory glance of the WAT formats, the bin from the website (shown on the left) has more exports and seems to target 64-bit platform whereas the output from master (shown on the right) has fewer exports and does not use i64 anywhere.

Screen Shot 2022-12-11 at 18 05 28

The reason I discovered this was because I have not been able to get nearly the same performance (more than 10x slower) compared to the WASM found on the demo site. Was this compiled using different flags? I have tried building on several different platforms but get the same results.

EDIT: I see that the website is CI built via GH workflow, I wonder if the toolchain has changed significantly since then, since I cannot explain the differences.

quexten commented 1 year ago

@blake-regalia Have you ever figured this out? I'm curious too.

blake-regalia commented 1 year ago

no 😢

quexten commented 1 year ago

Ok, so I compiled the latest master branch, and the resulting binary was actually faster than the one on the website. I compiled using the latest emscripten docker image (or in my case podman): sudo podman run --rm -v $(pwd):/src:Z -u $(id -u):$(id -g) --privileged -it emscripten/emsdk /src/build.sh

quexten commented 1 year ago

Here, only difference is recompilation using latest emscripten:

image

blake-regalia commented 1 year ago

Thanks, i've gotten it to compile correctly now. Although the performance is now the same as the website on my machine at least.