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