1 #!/bin/sh
2 # Build hash-wasm WASM modules from C source.
3 # Requires: clang with wasm32 target support
4 #
5 # The resulting .wasm files are embedded as base64 in argon2.umd.min.js
6 # (the UMD bundle in web/ext/). To regenerate the UMD bundle from new
7 # .wasm files, see the hash-wasm project: https://github.com/nicolo-ribaudo/nicolo-nicolo-nicolo/nicolo
8 # Original author: Dani BirĂ³ (hash-wasm)
9 10 set -e
11 12 CFLAGS="--target=wasm32 -O3 -flto -nostdlib -fno-builtin"
13 LDFLAGS="-Wl,--no-entry -Wl,--export-dynamic -Wl,--lto-O3"
14 15 clang $CFLAGS $LDFLAGS -o argon2.wasm argon2.c
16 clang $CFLAGS $LDFLAGS -o blake2b.wasm blake2b.c
17 18 echo "Built argon2.wasm and blake2b.wasm"
19 echo "To update the UMD bundle, base64-encode these and replace the embedded blobs."
20